Workflow fires when Image column stays empty

I have a Workflow that fires a Data Change Action. Updates only.
My workflow condition is:
[_THISROW_BEFORE].[Image]<>[_THISROW_AFTER].[Image]
When the image column is empty and I edit another column, the workflow will fire, even though there was no change in the image column.
If there is an image and I edit another column, the workflow will not fire.

The only workaround I found is to change the condition:

AND(
  ISNOTBLANK([Image]),
  [_THISROW_BEFORE].[Image]<>[_THISROW_AFTER].[Image]
)
2 Likes

Hi @Fabian ,

Thank you for sharing the experience. The solution you applied of adding ISNOTBLANK([Image]) in the workflow condition is indeed correct and recommended by AppSheet as well. The reason why it is needed is explained in the article below.

Please look for the description under the topic " Sending Email When a Row is Added, Updated, or Deleted"

"When comparing before and after values, be aware of the following issue. If both the before and after values are empty, the following expression always return ‘true’.

2 Likes

Try just this:

(("x" & [_THISROW_BEFORE].[Image]) <> ("x" & [_THISROW_AFTER].[Image]))

or this:

NOT(IN([_THISROW_BEFORE].[Image], LIST([_THISROW_AFTER].[Image])))
2 Likes

Hi @Steve ,

Innovative expressions as usual.

Since you have specifically recommended different expressions, could you please update if adding ISNOTBLANK([Column Name]) has any quirk or some such issue that we may be unaware of?

1 Like

Looking at this expression:

AND(
  ISNOTBLANK([Image]),
  [_THISROW_BEFORE].[Image]<>[_THISROW_AFTER].[Image]
)

My first thought is: to which does the unqualified [Image] refer? Before? Or after? I believe it refers to after. If so, then this:

[_THISROW_BEFORE].[Image]<>[_THISROW_AFTER].[Image]

is equivalent to this:

[_THISROW_BEFORE].[Image]<>[Image]

Given the quirk with the = and <> operators, this expression is TRUE if [_THISROW_BEFORE].[Image] is blank, regardless what the value of [_THISROW_AFTER].[Image] (or [Image]) is. That result is useless in this context. Wrapping this inequality expression in AND() and adding the ISNOTBLANK() test of [Image] doesn’t improve the result. Testing [_THISROW_BEFORE].[Image] instead helps, but doesn’t catch the case where before is blank but after isn’t, so we’d have to test for that, too:

IF(
  ISBLANK([_THISROW_BEFORE].[Image]),
  ISNOTBLANK([_THISROW_AFTER].[Image]),
  ([_THISROW_BEFORE].[Image] <> [_THISROW_AFTER].[Image])
)

Rather than that long convoluted expression, either of the two I posted are as effective, shorter, and easier to understand.

3 Likes

Thank you very much @Steve for the detailed explanation. Got it now.

I may request you to change the Workflow help article accordingly. I have been using the expression in the following format in workflow conditions, based on the Workflow article. So far it seems to have worked but as you mentioned, it could have potential issues.

AND( [_THISROW_BEFORE].[Status] <> [_THISROW_AFTER].[Status], ISNOTBLANK([Status]) )

2 Likes

Thank you so much @Suvrutt_Gurjar and @Steve I wasn’t aware of that.
I changed my post from Bug to Question :slight_smile:

2 Likes

This’ll be an ongoing process. The doc is long and needs a lot of work. But it’s on my to-do list.

3 Likes

Thank you @Steve

1 Like