How to catch changing of the variable?

Is it possible to realize smth like:

IF (value changed) then
...

Answers

  • SanderDkSanderDk Member Posts: 497
    Depending on where you a you can do:
    if rec.value <> xrec.value then
    DoMyBitOfCustomCode();

    And depending on your version you can have event subscriber for that

    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • JuhlJuhl Member Posts: 724
    Record field are not a variable!
    And variables are normally used internally in a function or the like, where it is under control of the developer.
    So I don’t really see the need.
    Follow me on my blog juhl.blog
  • DenSterDenSter Member Posts: 8,304
    For AL (or C/AL for that matter) there is no mechanism to track whether a particular variable has changed value. This could happen for instance when you send a variable into a function as a parameter by reference, and you want to see if the function has modified the value. You would need to create another variable, save your variable value into the new variable, and then after the function call you can compare the two.
Sign In or Register to comment.