Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of Stored Procedures
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00101049
Message ID:
00101121
Views:
27
>Dave,
>
>I don't think so. If I understand correctly, Rob is talking about adding an audit trail, or tickler, or something. I don't think this is a matter of ensuring a parent record exists when a child is added. Maybe Rob could clarify for us.
>
>>your complex rule is handled by vfp's referential integrity (RI).
>
>>>The problem is that some of my rules are more complex, like "Every time a record is inserted into table X, create a record in table Y". This usually will involve taking a value from the new record in X, doing a lookup in a support table and then inserting a record in Y with the data returned from the support table.

Rob,
From my experience, it would seem that you would build these rules as Stored Procedures that would be called as part of you INSERT/UPDATE/DELETE triggers.

In your example, you would write a function to create a record in table Y in your stored procedures ("AddtoY"). Then in the properties of table X, set your INSERT trigger to run the new stored procedure. Just be careful how you handle the call if there is already a function in yout INSERT trigger created by the referential integrity builder:

INSERT TRIGGER: _ri_insert_x() AND AddtoY()

Hope this helps you out.
I would give my left arm to be ambidextrous!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform