Best Formatting for Expressions

Hi, I’m sure this has been asked a number of times and I apologize in advance, but I cant recall reading it in documentation (I’m sure it’s there somewhere). My question is as follows, is the below formatting for my expressions a good idea, or I should use spaces / line breaks in different ways?

The example formula is as follows:

OR(
AND([Department] <> "ARCHIVE", CONTAINS([Department], "WINDING")),
AND([Department] <> "ARCHIVE", CONTAINS([Department], "ANGLEBOARD")))

I do it this way to make it more readable (especially for longer expressions) but if its going to lead to bugs (because of the line breaks) then I will format my expressions differently. Expert advice would be much appreciated!

Within templates, you should not use line breaks within expressions. Other than that, AppSheet doesn’t care about spaces and line breaks, so you’re free to break-up and indent expressions however you want.

Note that if you have a raw textual value that include spaces, quotes around the value are strongly recommended (and even required in some places). Raw textual values that include line breaks require quotes.

4 Likes

Thank you for the feedback Steve, I wasn’t sure, so its good to get clarification before copy and pasting a lot of these expressions : )

1 Like