Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert Triggers and Views
Message
 
To
28/10/1998 12:16:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00151695
Message ID:
00152148
Views:
28
>Figured as much. As you can probably tell, I'm experimenting brutally on some view stuff. I don't want to wait for the table trigger to fire. I'm looking for a way to simulate a view trigger. Suggestions? Or should it all be form or container class based? Make sense? Thanks.
>
>>Triggers can only be used with tables, not views. You can, of course, create a trigger on the view's underlying table, but it won't be called until you TABLEUPDATE().
>>
>>>Can one add an insert trigger for a local view? If so, where-oh-where do I look in the the help? MTIA

In a normal situation, I mean when dealing with forms, the only trigger you should worry about is the INSERT. UPDATE should be handled internally (what happens to the children if I change a parent primary key?) and DELETE with the TABLEUPDATE(). I don't see much use for some sort of PREDELETE() routine.

Back to the INSERT, most of my designs are either IGNORE (for things like lookup tables) or RESTRICT (in cases where I do not want a child added with no parent). You can deal with the RESTRICT easily in some BEFORESAVE() hook like this:

lnRetVal = .T.
IF EMTPY(theParentPrimaryKey)
*-- a message
lnRetVal = .F.
ENDIF

And your SAVE() should call the hook:
IF BEFORESAVE()
*-- then save
ENDIF

José
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform