• Not Answered

Compare the value of a variable with the value that variable had before the change

Dear all,

I need to compare the value of a variable with the value that variable had before the change, that is, I need to know if an input parameter has changed or not and, in case it has changed, to do a series of operations.

How can I do this?

Thank you very much in advance.

Best regards,

2 Replies

  • Create an extra variable (V2) to copy the value of the variable you change (V1).
    Also create a boolean (B) to indicate a change.

    In each scan first compare the 'change' value (V1) to the 'copy' value (V2).
    If unequal, the value has changed, so you set the boolean (B) for the change
    If equal, the value has not changed, so you reset the boolean.(B).
    Then copy the 'change' value (V1) to the 'copy' value (V2).

    So, the boolean (B) can be used to start to execute the mentioned series of operations.
    One of the ways to execute these operations is to include these in a composite block and execute an SFC or SFC's.

    This is just one of the many ways your challenge can be solved.
    Good Luck!
  • In reply to Maarten van der Waal:

    Hello,

    Thank you very much for your help.

    Do you have a programmed example that you can show me? Please do

    Best regards,