0

I'm having trouble finding an answer for how my JSON column formatting will be treated in SharePoint Online. Is there an order of operations/precedence based on the && (and) and || (or) operators, or is it simply read sequentially?

Take this statement, where I want to test the item to see if it has one of two acceptable Status levels as well as some value for Validation:

if([$Status]=='Pending' || [$Status] == 'Approved' && [$Validation]!='', 'inherit', 'none')

Is it treated as: if the Status is Pending and Validation is not null, or if the Status is Approved and Validation is not null, then inherit, else none. (This is what I want to test)

Or, is it treated as: if the Status is pending, or if the Status is Approved and the Validation is not null, then inherit, else none. (This wouldn't fit what I actually want to test)

If it is just read sequentially, then can I use brackets to force an order, like this?

if(([$Status]=='Pending' || [$Status] == 'Approved') && [$Validation]!='', 'inherit', 'none')

1 Answer 1

1

Conditions are simply read as sequentially.

First formula will be treated as:

If the Status is pending OR if the Status is Approved AND the Validation is not null, then inherit, else none.

You can use parentheses () to set the precedence. So, for your case you have to use the second formula in your question:

=if(([$Status] == 'Pending' || [$Status] == 'Approved') && [$Validation] != '', 'inherit', 'none')
1
  • 1
    Thanks for the clarification!
    – Darryl
    Feb 7, 2022 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.