Error on a document template, if I use more than one conditional expression send error on the second

Hello!, I hope you can help me
I'am creating a report with a document template, all was working good but when I'm trying to create some resume rows I had a problem, if the field has a zero value I don't want to show this row, so I write an conditional expression before it.

<<if: ([field1]>0) >>
table with 1 row: <<[field1]>>
<<EndIf>>

This worked fine but when I try to add another "if"

<<if: ([field1]>0) >>
table with 1 row: <<[field1]>>
<<EndIf>>
<<if: ([field2]>0) >>
table with 1 row: <<[field2]>>
<<EndIf>>

the workflow sends me this error

  • Error 1 : 'New process' task 'report' Body template. Expression 'If: ([field2]>0)' is invalid due to: Unable to find function 'IF:', did you mean 'IF'?.
  • Error 2 : 'New process' task 'report' Body template. Expression 'EndIf' is invalid due to: Expression refers to undefined field.
  • Error 3 : The document body is empty

The document is trying to find the if(conditional,true,false) syntax beacause I replaced IF: with IF and sends me the error that the syntax was incomplete.
the document only accepts one IF conditional?? I don't thing so...

thank you in advance

Solved Solved
0 2 163
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @ingalsaac76 

Templates can be tedious, but your expression looks correct.

As a start, you may want to simplify your expression this way:

<<if:[field1]>0>>table with 1 row: <<[field1]>><<EndIf>>
<<if:[field2]>0>>table with 1 row: <<[field2]>><<EndIf>>

(No parenthesis, and all in one row)

PLUS:

Can you check formatting is strictly the same on the If/End if part ? It causes issue into interpretation if not.

Here are examples of what you can do:

Aurelien_0-1657687698833.png

Here are examples of what you can't do:

Aurelien_2-1657687871155.png

(at the beginning, you can see a subtle change in formatting of each example)

 

 

View solution in original post

2 REPLIES 2

Aurelien
Google Developer Expert
Google Developer Expert

Hi @ingalsaac76 

Templates can be tedious, but your expression looks correct.

As a start, you may want to simplify your expression this way:

<<if:[field1]>0>>table with 1 row: <<[field1]>><<EndIf>>
<<if:[field2]>0>>table with 1 row: <<[field2]>><<EndIf>>

(No parenthesis, and all in one row)

PLUS:

Can you check formatting is strictly the same on the If/End if part ? It causes issue into interpretation if not.

Here are examples of what you can do:

Aurelien_0-1657687698833.png

Here are examples of what you can't do:

Aurelien_2-1657687871155.png

(at the beginning, you can see a subtle change in formatting of each example)

 

 

Hello! thank you for your help!, It was the parenthesis ๐Ÿ™„... I never think that would be the problem