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.
Solved! Go to Solution.
I finally found it and it was so simple that I feel a little embarrassed right now
I was only missing to put the formula inside a paragraph
<p> </p>
Thanks anyway.
Donโt escape <<
and >>
:
<<If:(COUNT([Related MyTable])>2)>>
Page to display
<<Endif>>
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
<< and >>
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 :
<<lookup(Useremail(),Users, Email,Prรฉnom)>>
or this
<<If(ISNOTBLANK(INDEX([Related Photos][Libellรฉ],1)),INDEX([Related Photos][Libellรฉ],1),"")>>
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
I was only missing to put the formula inside a paragraph
<p> </p>
Thanks anyway.
Thanks for sharing @Sebastien_Hourcaillo
I am making mine in google docs. I have spent several hours the past few weeks trying to figure out why my templates would sometimes throw this error when I made small changes to nested IF-statements.
Your discovery gave me a lead to chase. I experimented with soft and hard returns, andโฆ it appears that using hard returns between the start tags of two IF-statements break the connection between the opening <<IF: ... >>
tag and the closing <<Endif>>
tag.
Example of what I mean:
<<IF: [column_level1]>> //** Hard return *//
<<IF: [column_level2>>
<<[content]>>
<<Endif>>
<<Endif>>
Given that a GDoc is still just a webpage, this would wrap the start and the end tag in different paragraph tags.
Take away: whether you build your templates in HTML or Google Docs, make sure to put your IF-statements in a single paragraph.
Note to the Appsheets team:
I did not discover this earlier because Google Docs has a number of limitations, including that you canโt visualize things like soft and hard returns, section and page breaks.
Suggestion:
A small section in the documentation about these common, but hard to detect errors would be very helpful to avoid lots of frustration.
Sebastian...
I tried the same way, but results in error... Somebody knows what is happening?
<body><p><<If: ISNOTBLANK([1])>></p>... code HTML... <p><<EndIf>></p></body>
Thanks a lot for this. I was putting the full paragraph element between the If...EndIf expression start/end (as follows) and, as you encountered, the AppSheet error is unhelpful.
<<If: (...)>><p>...</p><<EndIf>>
I switched to the following and now the template works as intended.
<p><<If: (...)>>...<<EndIf>></p>
User | Count |
---|---|
36 | |
31 | |
30 | |
20 | |
17 |