Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating data in a parameterized view - VFP 3.0 Win
Message
From
12/11/1997 12:00:38
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00059719
Message ID:
00059739
Views:
27
>>>I have built my first form that uses a parameterized view. The form has the view in a grid and the data can be edited.
>>>
>>>The tables are not using buffering, the view is also set for no buffering (as far as I can tell). The parameter I pass in is the date and then only records that match the date are displayed in the grid.
>>>
>>>The problem is that when I change values in the grid, the changes are written back to one of the original tables, but they are written to too many records.
>>>
>>>The key that joins the two tables is a person's unique id, and the tables are in a 1 to many relationship with the many side of the relationship being updated by the grid.
>>>
>>>The problem is that every record in the child table that matches the unique id gets updated and not just the one that are updated in the view.
>>>
>>>Whew! Does this make sense?
>>
>>You have to define unique key in view designer for this particular view, i.e. it should include not only primary key on 'one' side, but also fields identifying uniqueness on 'many' side, i.e. it's child's primary key.
>
>My COMP 403 teacher may be rollover in her grave when I say this but... I don't have a unique key in my child table. A unique record would be specified by two fields. Example ID + VISITDATE together would identify a unique record in the child. Note: ID is the unique key from the parent table. Can I specify two fields as a "compound key" (my term), for the view?

Yes, sure. Look at 'Update Criteria' page of View Designer. You have to check both fields as 'keys'.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform