Comparing Column values before and after

I am trying to write a condition for a workflow. The workflow should only execute if any of these values are true.

OR(
[_THISROW_BEFORE].[Status] <> [_THISROW_AFTER].[Status],
[_THISROW_BEFORE].[Stipulations] <> [_THISROW_AFTER].[Stipulations],
[_THISROW_BEFORE].[Note to representative] <> [_THISROW_AFTER].[Note to representative]
)

However, it is executing the workflow when it encounters empty values for those columns, even if the previous values were empty. When Appsheet compares before and after values, why is a before empty cell considered different than an after empty cell?

1 Like

Thanks Steve.
Interesting. Is this for a specific reason, or is it just an error?
Is it something that is going to change in the future?
What is the ideal way to make this work?

It seems to do this only with the [_THISROW] function. I just ran an expression:

[_THISROW].[Notes]<>"" and the result is TRUE even though the cell is blank.

[Notes]<>"" however, results in FALSE, correctly representing a blank cell.

I believe it was a conscious decision made long ago.

I don’t know, but I don’t expect it to change.

If one of your two operands is guaranteed to be non-blank, put it on the left side:

"OK" = [Status]

Otherwise, explicitly test the left operand first:

AND(ISNOTBLANK([Status]), ([Status] = "OK"))

In your case:

OR(
  IF(
    ISBLANK([_THISROW_BEFORE].[Status]),
    ISNOTBLANK([_THISROW_AFTER].[Status]),
    ([_THISROW_BEFORE].[Status] <> [_THISROW_AFTER].[Status])
  ),
  IF(
    ISBLANK([_THISROW_BEFORE].[Stipulations]),
    ISNOTBLANK([_THISROW_AFTER].[Stipulations]),
    ([_THISROW_BEFORE].[Stipulations] <> [_THISROW_AFTER].[Stipulations])
  ),
  IF(
    ISBLANK([_THISROW_BEFORE].[Note to representative]),
    ISNOTBLANK([_THISROW_AFTER].[Note to representative]),
    ([_THISROW_BEFORE].[Note to representative] <> [_THISROW_AFTER].[Note to representative])
  )
)