Incorrect Error Given Workflow template

Hi! I have this formula:

If([Include _'s Store Visits?]=”No”,Start: Orderby(Select(Previous Years Report[Key],And([Company]=”Gonnella",Contains([_ThisRow].[Store Lists To Include In Report],[List]))),[Today]),””)

This formula is in a workflow template. However, I get an error message on AppSheet telling me:

Workflow rule ‘Previous Year Report’ action ‘Previous Year’s Report’ Body template. Expression ‘Orderby(Select(Previous Years Report[Key],And([Company]=”Gonnella",Contains([_ThisRow].[Store Lists To Include In Report],[List]))),[Today]),””)’ is invalid due to: Expression ‘Orderby(Select(Previous Years Report[Key],And([Company]=”Gonnella",Contains([_ThisRow].[Store Lists To Include In Report],[List]))),[Today]),””)’ could not be parsed due to exception: Number of opened and closed parentheses does not match…MORE INFO

This error is incorrect, however, as I have 5 “(” and 5 “)”, and they are placed in the correct positions, I beleive. Would anybody be able to help me fix this issue? Thanks!

0 8 522
8 REPLIES 8

Jonathan_S
Participant V

maybe look at your “”""

Hi @retailpartnercom,

If you look at the error thrown by editor, the parser is not taking the part of expression before Orderby

The error message starts with Orderby rather than If([Include _'s Store Visits?]=”No”, Start:, in your expression. This shows that the expression part before Start: that is **If([Include _'s Store Visits?]=”No” Start: ** is treated as a separate expression. As a result, the terminating part of your expression ,[Today]),””) which is actually result part of IF expression is treated inside the Orderby(… expression while evaluating but its starting part **If([Include _'s Store Visits?]=”No”, Start: **is outside the expression. So you are getting one extra bracket and error.

I believe you will neeed to close your Start: expression at appropriate place with an << End >> and even before start you need << such as <<Start:

The above suggestion is only related to syntactical error thrown by the parser.

Hope this helps

Hi @Suvrutt_Gurjar! I tried placing a “<<” before my start, and an extra “>>” at the end, but it didn’t work. I should place the <> after everything on the page, right? I already have that. Thanks a lot!

Hi @retailpartnercom,

Thank you. My response was in general related to why you are seeing syntactical error for mismatch in parentheses.

I believe for properly formatting your expression, you may also wish to take a look at the very informative article below , just in case you have not. The artilce also describes using IF and Start: statements in templates.

Hope this helps.

Hello @Suvrutt_Gurjar! The article only helps a little bit. My parenthesis still match, but now it is still not working. HERE is the document. Is there anything wrong with my document? I looked for all parenthesis with cmmd + F, and )/( matched in #. I also colored the parenthesis to make sure they matched, and they still did. Any advice? Thanks!

It might be easier for me to just create 8 workflows instead of 4, to separate the ifs into their own document, so it works without all this pain. I appreciate the advice and your time! Thanks! @Suvrutt_Gurjar

Steve
Participant V

The fundamental problem is the occurrence of Start: in your expression. It should be removed.

Also:

  1. [Include _'s Store Visits?]=”No” is better written as NOT([Include _'s Store Visits?]).

  2. Select(Previous Years Report[Key], ...) is better written as FILTER("Previous Years Report", ...).

  3. [Company]=”Gonnella" is better written as ”Gonnella"=[Company] to avoid unexpected results because of the quirky behavior of the = operator.

  4. Contains([_ThisRow].[Store Lists To Include In Report],[List]) may not work as intended. The second argument should be a single value, but [List] would appear to be a list. CONTAINS() is not designed to compare lists.

Read more:



Thanks!

Top Labels in this Space