Error in template if expression when including a Start expression

Hello.

I have this expression in my template:

 

<<If: (ISBLANK([parcelasPrestacao])) >>
<<[stringAVista]>>
<<EndIf>>

<<If: (ISNOTBLANK([parcelasPrestacao])) >>
<<Start: [parcelasPrestacao]>>
<<[stringParcela]>>
<<End>>
<<[stringParcelado]>>
<<EndIf>>

 


That returns this error:

Error encountered in step with name [geraContratoPrincipal]: Error: Task 'geraContratoPrincipal' Attachment template. Expression 'If: (ISNOTBLANK([parcelasPrestacao]))' is invalid due to: Unable to find function 'IF:', did you mean 'IF'?. Error: Task 'geraContratoPrincipal' Attachment template. Expression 'EndIf' is invalid due to: Expression refers to undefined field.

But, if I put the Start outside the If expression, like this:

 

<<If: (ISBLANK([parcelasPrestacao])) >>
<<[stringAVista]>>
<<EndIf>>

<<If: (ISNOTBLANK([parcelasPrestacao])) >>
<<[stringParcelado]>>
<<EndIf>>

<<Start: [parcelasPrestacao]>>
<<[stringParcela]>> 
<<End>>

 

It's works with no issues

Solved Solved
0 7 90
1 ACCEPTED SOLUTION

Update:
Honestly, I don't know what was happening, but I solved the issue by creating two bots and two templates and solving the if condition outside the template.

Thus, if (ISNOTBLANK([parcelasPrestacao]) is true would go to bot A (and template A) and if
(ISBLANK([parcelasPrestacao])) is true would go to bot B.

View solution in original post

7 REPLIES 7

You should think about IF: like IFS() rather than IF(). It doesn't have else component and that's why it doesn't work.

But if I remove the start it's work just like that.
Also, I am following this:
https://support.google.com/appsheet/answer/11568425?hl=en&sjid=1406931616911163521-SA
You can see there is no major difference between what I did and their example:

Include Start expressions in If expressions

You can include <<Start>> expressions in <<If>> expressions. For example:

<<If: COUNT([Related OrderDetails])>0>>

Order Detail Records

<<Start: [Related OrderDetails]>>

Product: <<[Product]>>
Qty: <<[Qty]>>
Amount: <<[Amount]>>

<<End>>

<<EndIf>>


 

But if you check this last sample, it doesn't have the "Else" component with the IF:, and that's why it will work.

I didn't added an else, just a set of things that would happen.
but I tried to isolate to one action for each if, the result is the same:

<<If: (ISBLANK([parcelasPrestacao])) >>

<<[stringAVista]>>

<<EndIf>>


<<If: (ISNOTBLANK([parcelasPrestacao])) >>

<<Start: [parcelasPrestacao]>>

<<[stringParcela]>> 

<<End>>

<<EndIf>>

 

<<If: (ISNOTBLANK([parcelasPrestacao])) >>

<<[stringParcelado]>>

<<EndIf>>




Run task "Task for geraContratoPrincipal"

  • Error 1 : Task 'geraContratoPrincipal' Attachment template. Expression 'If: (ISNOTBLANK([parcelasPrestacao]))' is invalid due to: Unable to find function 'IF:', did you mean 'IF'?.
  • Error 2 : Task 'geraContratoPrincipal' Attachment template. Expression 'EndIf' is invalid due to: Expression refers to undefined field.



The issue is related to having a <start> inside an <if:>
If I do in any other way it's works, but I need the <start> being conditionally triggered

So.. if you remove the <<[stringParcelado]>> away, it will work.

Update:
Honestly, I don't know what was happening, but I solved the issue by creating two bots and two templates and solving the if condition outside the template.

Thus, if (ISNOTBLANK([parcelasPrestacao]) is true would go to bot A (and template A) and if
(ISBLANK([parcelasPrestacao])) is true would go to bot B.

Top Labels in this Space