OR expression works like a AND expression in SHOW_IF

Hello all,

I’m having trouble with the OR() expression in SHOW_IF. It seems that appsheet sees this as an AND() expression, I have this problem in multiple forms. Is there a solution for this?

Previously this worked well.

Thanks in advance!

You need to elaborate. What are your conditions and why do you think the OR() is being treated as an AND()?

2 Likes

I have two choice menus when something is selected in one of those choice menus then another button has to disappear automatically. That’s not happening. Only if I select something on both.

I’ve used several ways with show_if:
OR(ISBLANK[column_1], ISBLANK[column_2])
OR([column_1] = “”, [column_2] = “”)

It doesn’t matter how I use it only if both are TRUE then the button disappears.

It seems so simple…

I’ve tried AND() instead of OR(), and it works!

AND() expression has become OR()

Who did that? I don’t think this is intended. Or am I crazy… :wink:

And the worrying thing is that a number of my forms no longer work properly as a result

If AND() and OR() were not working correctly, it would impact ALL apps across AppSheet and would have been reported LOUDLY by the Community by now. More than likely, you are making some assumptions about the expected results, when using ISBLANK() and testing for “”, that are not accurate. The column types you have defined and any Initial Values can impact the expected results of these So, I can’t provide any more insight without knowing those details.

To truly understand it and identify if there really is a problem, I would recommend placing each portion of the expressions in their own column so you can see what result they contribute to the AND()/OR().

Never-the-less, I will run a quick test of my own to check it out and report back.

3 Likes

Ok, I have tested and both OR() and AND() seem to be working correctly in my use case. See example below

I have Columns Test1, Test2, Test3, and Test4, all defined as Text columns.

  • Show_If expression for Test3: OR(ISBLANK([Test1]), ISBLANK([Test2]))

    • i.e. Show Test3 if Test1 is blank or Test2 is blank or BOTH are blank
  • Show_If expression for Test 4: AND(ISBLANK([Test1]), ISBLANK([Test2]))

    • i.e. Show Test4 only if BOTH Test1 and Test2 are blank

If I enter a value in Test1, the Test4 column hides, as expected, since it is NOT the case that BOTH are blank. However, Test3 still shows because Test2 is still blank.

If I continue and add a value to Test2, now both Test3 and Test4 are hidden, as expected.

Initial entry fields

![Screen Shot 2022-05-17 at 8.44.44 AM.png|708x1220](upload://4aNgeCWRfBvwKa9RpzV9nbvEfC6.png)

Test4 hides after entering a value in Test1

![Screen Shot 2022-05-17 at 8.45.01 AM.png|698x1198](upload://sp3UtVDrHH8KYPOqXo3JDRPsP5L.png)

Test3 also hides when values are present in both Test1 and Test2

![Screen Shot 2022-05-17 at 8.45.22 AM.png|694x1186](upload://rBy1VCvUiaXNRAjDoyh23vR9Mm1.png)
2 Likes

Thank you for the extensive testing.

My apologies: I forgot to mention that these are ENUM fields.

I’m going to build a test app to see if the problem is the same (or not)

1 Like

SHOW_IF of kolom_3: OR([kolom_1] = “”, [kolom_2] = “”)

I have now created a new app but the same problem persists (see the screenshots below)

This looks obviously a glitch to me. Better to report to support for help (correctly a bug report to fix this problem.)

There is no issue with OR or AND, they are working exactly as they should be. The issue is with your logic.

You seem to be thinking that “show_if” is actually “hide_if”. It’s not.

In your test example, you’re telling the kolom_3 field to be visible if either 1 or 2 is blank. That means it will NOT be visible is neither are blank, i.e. when you select something in both 1 and 2 fields, 3 is hidden.

2 Likes

I tested quickly and this is potentially a bug. I passed and(isblank([col1]),isblank([col2])) expression to [col3] to show if.

Once the col1 is set a value, then col3 was hidden, while and(isblank([col1]),isblank([col2])) returns false.

What you described is exactly how the logic should be working. What is the potential bug?

1 Like

Haha my logic is not correct, everyone has shouted all my life :wink:

I created a bug report, only they refer me back to the forum. It’s about the And and OR Expression, it’s not right.

I now have an example with and:

Maybe if you can describe in plain language what you’re trying to accomplish, someone can suggest a show_if formula for you to use.

1 Like

2022-05-17_23-23-54.gif

.

1 Like

and(isblank([col1]),isblank([col2])) is passed to VC to test to see what is the return.

The same expression is passed to show if for Enum. While the same expression returns false. then the Enum is hidden.

For me, a bug, while you believe it is not. I wont argue with that point though with you.

If I start using AND() as an OR () it just works and I get the result the way I want it. But I don’t think that’s the intention.

OR () = Any
AND () = ALL

And that is exactly the other way around with show_if.

Isblank([Col1]) and [Col1]=“” returns the same result. For me, it is a bug (if not a bug, it is a glitch)

Yes, when the show_if condition is false, the column is hidden. Your example is still working exactly as it should.

Again, it’s SHOW_if, not HIDE_if.

If you want the field hidden when both are blank, that’s equivalent to showing the field when either one has a value, so:

OR( ISNOTBLANK( [col1] ) , ISNOTBLANK( [col2] ) )

3 Likes

So this expression is giving you the result that you want:

AND( ISBLANK( [col1] ) , ISBLANK( [col2] ) )

?

That’s saying to show the column only if both other columns are blank.

That’s equivalent to hiding the column if either 1 or 2 has any value.

3 Likes