Which field on a form/table is modified

If I on a form modify the value in some field2, can I before updating the table see which fields are modified ? I have made my own little function, where I compare Rec and xRec, but it would be easier if there already were a standard function to do this.

I don’t think that kind of function exists. The only method I know is, as you said, to compare xRec.Field2 <> Rec.Field2

The function CurrFieldNo will solve Your problem. It’s explained in the on-line help

No, it isn’t

Oups! I assumed it was. I cannot even find it in the C/AL Symbol Menu. Newertheless. CurrFieldNo returns the number of the field in the table that the user had focus on when the code triggered. An easy way to decide if an OnValidate Trigger of a field is triggerd by code or bye a user entering something in the field, is to test if CurrFieldNo <> 0. If so it’s a user entering something in the field. If not the code is called from toher code by MyTable.VALIDATE(MyField)

Lars’ [second] solution is a messy one if you hava a form containing a lot of fields. But the only one for the time beiing. Perhaps not - you may use Record- and FieldRef; create a global function [in a codeunit]; call this function OnModify in the table with two parms, Rec and xRec; in the function read all fields with FieldRef and compare. Sounds like a suitable solution? This is actually a standard funtion in Attain called “Change Log”. And it is not called from OnModify but from Codeunit 1.

quote:


Originally posted by Anfinnur
Perhaps not - you may use Record- and FieldRef; create a global function [in a codeunit]; call this function OnModify in the table with two parms, Rec and xRec; in the function read all fields with FieldRef and compare.


Interesting … i will note this [:D]

Thx, looking at the code in “Change Log Management”, it just makes you wonder how much this is slowing down navision.