Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Updating a paramaterized view
Message
De
02/06/1998 16:22:32
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00104154
Message ID:
00104189
Vues:
26
>>Sorry for the really basic questions, but I'm trying to make sure I understand this whole thing before diving into the deep end.
>>
>>Thanks,
>>
>>Sylvia
>Sylvia,
>
>Your questions are not to be appologized for by any means. The concept of views is this, I can have pseudo tables of data that look very different from the actual tables that the data is stored in for a variety of different purposes. This idea alone indicates that you will have more than one view in a system.
>
>If you have a combobox that is used to select a child record based on a parent record, you make a view of the child table with the parent primary key as the parameter. When your user tells you the parent records you set the parameter variable and then requery() the child view. If the view is being used to populate a combo or list you must also call the requery method of that combo or list so it will look again at its rowsource to see that the contents have changed.
>
>If I had to deal with a parent to child to grandchild relation in a fomr I would use two parameterized views, one for the the child with the parent PK as the parameter and one for the grandchild with the childs PK as the parameter. This way I can let the user select the parent and then show them the children, as they chose a child I can then show them the grand children for that child.
>
>The controlling of the requerying of the views is handled in the events of the various controls. For example; say you have a form with a list of parent records. I would bring the form up with nonparent selecte4d and with the child and grandchild views open with the NODATAONLOAD set to .t.. In the Valid event of the parent list I would set the parameter variable for the child view and then Requery("ChildView") and THISFORM.ChildList.Requery() which will populate the child list with the children for the selected parent. I would do essentially the same thing in the child list for the grandchild.
>
>Now you may have to make some assumptions to keep everything going well, like assuming that upon selecting the parent the first child should be automaticaly selected and the gradnchild list populated accordingly.
>
>I know this is a lengthy reply but I hope it gets you thinking in terms of simplifying each piece of what you need to do and getting that simple piece working flawlessly and then introducing another simple piece. After a bit of this you end up with a simple but sophisticated interface.

Jim -

Thanks for your reply. You answered one of the questions I had by recommending a second view for the grandchildren, which I hadn't considered. But I am still uncertain as to whether I need to do this, i.e., what does it buy me? In the first situation, it's clear to me - a view shows me just the children related to this parent. However, in the case of one of these grandchildren I want to see all of the possible cities in case the person needs to edit the address record. So it seems to me I wouldn't need a view for that situation, is that correct?

The other question is still which table reference do I use for the control source in the controls which are using that view? Again, I'm assuming that I should be using e.g. Controlsource = Myview.field1, etc. and then updating the fields in the original table with those values.

Oh, one other thing. I'm not using the data environment (I'm opening all my tables in the load event of my form). So it looks to me like I should be using the Noupdate parameter of Use.

Thanks again,

Sylvia
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform