Hi
I have some code on a Table.OnModify trigger. When modifying is done from a form, everything works fine.
However, if the modify trigger is called like "table.modify(true)", rec and xrec in the onmodify trigger are the same.
Is this be design?
Many thanks in advance
Thomas
0
Comments
I know it is anoying but that is the way it works.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
What you should do is before changing the table store the xrec in a variable. After the modify you can call the function with the new and old record variable.
Table 5050 is very usefully. I just clear about xrec now too
Best Regards,
Klum
When you implement this using a PARAMETER called xRec, then the User-Defined-Function (not the trigger) called OnModify can reference this parameter, but any function called inside the UDF will still be referencing the (incorrect) xRec.
For Example
OnModify() //trigger
OnModify(xRec)
OnModify(xRec : Record Contact) //user defined function. this work around is shown on table 5050
IF xRec.Name <> Name THEN
MESSAGE('This xRec reference works correctly');
SubFunction();
SubFunct() //sub functions using xRec DO NOT WORK with this workaround, because the PARAMETER xRec is never passed to them!
IF xRec.Name = Name THEN
MESSAGE('This xRec reference incorrectly references the same thing as Rec');