Old legacy branch condition changed behaviour

Hello,

I have an expresion used as a branch condition for an action in an older app of mine. This branch condition worked with no issues so far, until this week at some point , when instead of False it acted like a True .

And(isnotblank([stadiu]);
[stadiu]=“finalizare”;
Count(select(comenzi[x4];and([x4]=[_thisrow].[id task];or([status]=“nepreluat”;[status]=“pregatita”))))>0)

The basic logic is that if I “close” a client that still has open orders it does an action.

The action starded to apply in the last few days even when there were no open orders.

As a test , so far , I used the same expresion in a virtual column, and it returns False (N).

I also used the count() from the expresion in another VC and it returns 0.

But the action still trigers, and in Monitor section I see it acts like True (Y).

I think it might have something to do with Legacy vs Consistent. It was in Legacy until today. I tested with consistent and it seems fine now, but without me understanding it.

In help sections , I saw that [blank]>0 returns false in all instances of legacy or consistenct…in case my count() somehow returs [blank] , so it should have worked fine with either setting.

Please help me understand this case , so I might have better chances of figuring out where in my other apps I could have issues I don’t know about yet.

Thank you

I don’t think the expression itself is the problem. You are likely running into data situations you haven’t considered.

Please provide us with some data examples that you believe are behaving incorrectly with your expression so we can help you through that understanding.

2 Likes

I have the same issue.

A branch condition I have been using for the past year stopped working properly about a week and a half ago. Nothing had changed in the data structure nor the Bot making the call.

The True branch is now being ignored and the False branch is always followed.

I have been trying to debug this for over 2 solid days. Nothing has an impact.

To be clear, the table in the condition branch is the table the bot initially references.

Here is the branch code which I have simplified as much as possible but still doesnt work:

===========

(COUNT(
FILTER(
“Next of Kin”,
AND(
([CR#] = [_THISROW].[CR#]),
(TRUE = [Signed]),
(TRUE = [Active]),
(TRUE = [Appsheet Nok])
)
)
) = 0)

===========

I have error checking in place via sms txts that are generated in the process. Everything looks as it should, its just the conditional branch that is not executing properly.

I have to wonder if some backend change took place at Appsheet because there are 2 of us with the same issue.

Penny

1 Like

Does anything change for you too if you change that Legacy/Consistent setting?

No.

I changed the app to Consistent yesterday but I get the same result.

I agree that there are now 2 of you with apparently the same issue that its much more likely that some bug was introduced. Others are probably being impacted and not yet aware of it. I would encourage BOTH of you to submit an item to AppSheet support.

The “Legacy vs Consistent” setting only deals with how a “blank” result is handled in comparison operations. There was a difference in the past between the device side and server side when executing identical expressions. The difference was fixed but there was backward compatibility problems with older apps - hence the reason for the setting - so app creators can control WHEN to switch to “Consistent” - presumably after fixing their code to match.

Today, you should ALWAYS use “Consistent”. If you are working on older apps, you should switch to “Consistent” and fix any related problems. The fact that this setting is listed under “Legacy” is a good indication that this setting is not intended to be supported indefinitely.

Now…

Whether this setting impacts each of your particular use cases…I can’t be sure sure. One thing you could do to verify, is REPLACE your current COUNT() expression with an IF statement similar to the below that forces a zero when the returned list is empty:

IF(ISBLANK(<<expression that returns list>>),
     0,
     <<original COUNT() expression>>
)

This kind of expression, for each of your use cases, renders the Legacy setting ineffective so you can verify of the setting actually could be making a difference. If you see no difference in the issue you are having then this Legacy setting is not the culprit - something else is going on and should be raised to support.

If things begin to work, but don’t without the IF() and Legacy setting ON, then maybe the AppSheet Legacy implementation was removed creating a bug. Support should be contacted.

1 Like

There is definitely something screwy with appsheet.

I rewrote my event as 2 events in order to remove the conditional branching.

One event triggers if false, the other triggers if true. They work properly.

But there is something screwy with appsheet true/false. I have another trigger that sends a webhook when a row is added. The webhook does not fire and the audit log shows that the event returned false so didn’t fire.

When I change back to legacy the event triggers and the webhook is fired.

This is the event trigger:

AND(
(TRUE = [Active]),
(TRUE = [Appsheet Nok]),
([_THISROW_AFTER].[Total NOKs] > [_THISROW_BEFORE].[Total NOKs])
)

Total NOKs is never blank. there is nothing here that could be affected by comparison behaviour.

I also noticed that a table column (Yes/No) that I set the display values to “Yes” and “No” actually display as “N” and “Y”.

Thank you, I will try that and come back.

Can a count() return a [blank] value?

That is what the expression is testing. I actually don’t recall if in the “legacy” implementation treated COUNT(“blank”) different than COUNT(LIST(“blank”)) - i.e. no items vs a LIST of “blank” items. But that seems to be the area of commonality.

1 Like

I have opened a ticket. They have sent the issue to a specialist. I think it goes beyond count() issue. TRUE/FALSE returns seem to be affected.

I’ll let you know

4 Likes

I have oppened a ticket as well, but when I did a test again , it worked fine for me. I guess your ticket solved my issue as well.

The ticket operator did not gave me explanations, but recommended to use consistent for now on. I will, but with no easy way to check if my older apps will be affected. Thanks for your ticket

Actually it works in legacy now, but does not behave correctly in consistent anymore.

And I can’t find the chat from my ticket

Before I opened this thread I wrote the count() value in physical column, while testing the issue. The written value in cell was always 0 , not blank.

Anyway, unfortunately right now the legacy behaviour is ok, but the consistent behavior is not anymore, it does not apply the action when the branch condition is true.

I am waiting for a solution from support.

I rewrote my expresion as

And(isnotblank([stadiu]);
[stadiu]=“finalizare”;
or(
Count(select(comenzi[x4];and([x4]=[_thisrow].[id task];or([status]=“nepreluat”;[status]=“pregatita”))))>0;

isblank(Count(select(comenzi[x4];and([x4]=[_thisrow].[id task];or([status]=“nepreluat”;[status]=“pregatita”)))))
)
)

It did not solve the issue :disappointed_face:

My testing results :

  1. Legacy and true logical expression , branch is true (OK)

2.Legacy and false logical expression , branch is true (not OK)

3.Consistent and true logical expression , branch is false (not OK)

4.Consistent and false logical expression , branch is false (OK)

So Legacy always returns True , Consistent always returns False

I haven’t had a response from support yet. I was told they would contact me by email once the specialist had his results/solution/Qs.

I have the same issue with Constant. I had to revert to legacy. There was a whacky issue w TRUE/FALSE (nothing to do w Count()) in some other processes.

I have a workaround for the count() issue in my failing Bot but I havent implemented it on live app because I want to see if the issue is fixed. (Meantime I prefer to make manual fix after the fact so I can keep an eye on it.)

I believe it may be fixed because I had a user trigger the bot last night and it performed correctly.

So, maybe Count() is fixed in Legacy (I’ll confirm that when it is triggered again in another live app I have). But maybe Consistent, and its overall issues are not yet fixed.

Attn @Aleksi @devingu

1 Like

Dear Google Support team.

I am experiencing a similar phenomenon in my environment.
I was directed to this thread by AppSheet support, but to my surprise, no Google member has responded to this thread in any way.
What the heck is going on?

Customer app data keeps getting corrupted. If there really is a problem with the logic, please make an announcement about the problem as soon as possible.

@zito
@Lauren_vdv
@Roderick

@Steve
@Aleksi

2 Likes

Hi all. Just saw this thread. The last time we have deployed, is 12/21/2022, but nothing after that. Let me check this from our devs in the US if we have touched that part of the code.

1 Like

It seems that our devs are aware of this and they are investigating the root cause.

6 Likes