I've got a client with a wonky situation where the data (for some unknown reason) gets "blanked out" (not deleted, mind you...just some fields set to blanks).  I wanted to add an UPDATE trigger so that I could get some sort of historical update accounting to help me hone in on where the problem might be.

If I've used triggers in VFP then I've totally forgotten how to use them.  (Keep in mind that I haven't used VFP DBFs since 2004! This is an app I took over for one of our former buddies, Jeff Johnson, after he passed away.)

I use triggers in MySQL/MariaDB all the time.  There, I've got the record object in the OLD and NEW object keywords.   Looking at the CREATE TRIGGER Command in VFP help makes me think that the table is the currently selected work area, and as such, I could just do a SCATTER MEMO NAME oRec and then use that oRec variable to insert values into a separate table.

Wanted to bounce this off the community prior to my testing that theory tomorrow.  Does that sound right?  Tips for a better way to do it?   I was going to create a "shadow" copy table and just basically do the following in a database stored procedure:

* assuming current work area is the table where the UPDATE trigger is firing
LOCAL oRec as Object
SCATTER MEMO NAME oRec
INSERT INTO MyTable_COPY FROM NAME oRec

IF isblank(oRec.Field1) and isblank(oRec.Field2) and isblank(oRec.Field3) then && alert MBSS of problem scenario that should never happen but this must be the bug happening!!!!
   DO EmailMBSS
ENDIF


Can it really be that easy?

tia,
--Mike



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to