HTML Template : Expression IF/ENDIF not working

Hi everyone,

I’m new to appsheet so I apologize if I’m making any mistake on how this forum works.

I’m generating a PDF document through a bot with an HTML template and it’s working perfectly.
Unfortunatly when I use the IF / ENDIF statement (in order to show/hide some pages) I have the following error messages in the monitor log :

Unable to find function ‘IF:’, did you mean ‘IF’? […]
Expression ‘Endif’ is invalid due to: Expression refers to undefined field

It is written like this in my HTML document :

  <<If:(COUNT([Related MyTable])>2)>>
 	Page to display
  <<Endif>>

It seems that it doesn’t recognize the IF: function in the HTML template document.
I use to have a word document template working with this expression so I’m quit sure it is correct.

I’ve been looking a lot through this great forum but didn’t find any answer.
Hope anyone can help me.

Thank you and have a great day.

Don’t escape << and >>:

<<If:(COUNT([Related MyTable])>2)>>
 	Page to display
  <<Endif>>
1 Like

Hi Steve,

Thank you for the reply.
The problem is that when I put it like that I’m getting this error message :

Name cannot begin with the ‘<’ character, hexadecimal value 0x3C. Line 1235, position 2. Error: The document body is empty.

Beside, in the entire HTML template I’m using everytime the

&lt;&lt; and &gt;&gt; 

to replace the

 << and >>

and it’s working great

Hi everyone,

Anyone who can help me on this ?

Just to let you know that on my HTML template I’m using this kind of conditions :

&lt;&lt;lookup(Useremail(),Users, Email,Prénom)&gt;&gt;

or this

&lt;&lt;If(ISNOTBLANK(INDEX([Related Photos][Libellé],1)),INDEX([Related Photos][Libellé],1),"")&gt;&gt;

And it works perfectly.

I really don’t understand why it doesn’t allow me to do the “IF:” “ENDIF” which is I think the only way to hide pages unless you have any other ideas.

I’m stuck and would be really grateful if you could lend a hand on this …

I finally found it and it was so simple that I feel a little embarrassed right now :roll_eyes:

I was only missing to put the formula inside a paragraph

<p> </p>

Thanks anyway.

2 Likes