Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating new parent and child records in framework
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00187768
Message ID:
00187826
Views:
21
I guess I don't understand the intent of your question. Users want to be able to click their Add button, add a parent, select some related records, and click Save. These records are related many-many with the parent, so I make child records in the table that relates them.

The most common example would be the creation of a new order and selection of products. One would not want to have to create an order with no items, click save, then click again to add order-items. But I would like my Add and Save code to be very generic, so I can use it in a variety of data entry forms.

>Um, why aren't you just updating your views?
>Worst case, you could trap the error and keep looping through, then go back through to get the children. < I'm not recommending this latter method, btw >
>
>>My Save button code loops through the open cursors in AUSED() and does a TableUpdate() on each. This code originally comes from the txtbtns class of WIZSTYLE.VCX. The problem is that when both a parent and a child record have been added, a "trigger failed" error can occur, probably because the child happens to get updated before the parent, and there is no corresponding parent record yet. I need a generic and flexible means for the framework code to determine which cursors should be updated first. I usually have parameterized views for the child grid and therefore no relation in the Form.DataEnvironment.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform