Error in expression

Hi!!
I have that text in a report:

<<IF(
	[EF normal]=TRUE,
	Buen estado general, normocoloreado y normohidratado, <<IF(
	[Cicatriz de BCG]=TRUE,
	CONCATENATE(“Presenta “,[Localizacion cicatriz de BCG]),
	“No presenta cicatriz de BCG”.
)>>. No se objetivan lesiones oculares, ni alteración de la movilidad ocular. ORL sin alteraciones. Auscultación cardiopulmonar con buena ventilación bilateral sin ruidos sobreañadidos. Ruidos cardiacos rítmicos, sin soplos. Abdomen blando, depresible, sin masas ni megalias, no doloroso a la palpación. Consciente y orientado, sin signos de focalidad neurológica ni signos de irritación meníngea. No se palpan adenomegalias.,
	"[Hallazgos en EF]")>>

But there is a mistake that I cannot find… I get the next error message:

Error: ‘proceso enviar pdf’ task ‘enviar info en pdf’ Attachment template. Contains expression ‘<<IF( [EF normal]=TRUE, CONCATENATE(“Buen estado general, normocoloreado y normohidratado”, <<IF( [Cicatriz de BCG]=TRUE, CONCATENATE(“Presenta “,[Localizacion cicatriz de BCG]), “No presenta cicatriz de BCG”.)>>’ having a start token ‘<<’ without a matching end token ‘>>’

Is it because I have a IF expression inside another one??? I’m trying for long time… and read about IF expression, but don’t know what the problem or if there is any other formula better than IF…

Thank you all!

Hi @Daniel_SecodeLucena

I think you forgot the <<EndIf>> at the end of your If expression ?
In Email body, IF does not work the same than in AppSheet usual formulas.
There is no IF(expression, expressionTrue, expressionFalse).
in email body, this is just: IF (expression, expressionTrue)

Please have a look here:

3 Likes

You have a template tag within a template tag, which isn’t allowed:

<<IF( ..., <<IF( ... )>>, ...)>>

The inner template tag appears to be unnecessary, so the expression should instead look like this:

<<IF( ..., IF( ... ), ...)>>
4 Likes

Thanks a lot both of you!!
Now I understand!!

I finally solved write it like this:

<<IF: [EF normal]=TRUE>> Buen estado general, normocoloreado y normohidratado <<EndIf>> . <<IF: [Cicatriz de BCG]=TRUE>> Presenta cicatriz de BCG en <<[Localizacion cicatriz de BCG]>> . <<EndIf>> <<IF: [Cicatriz de BCG]=FALSE>> No presenta cicatriz de BCG. <<EndIf>> ...
<<IF: [EF normal]=FALSE>> [Hallazgos en EF] <<EndIf>>

I think it’s a little bit artificial but it works!!

3 Likes