Hi Champs,
I am using docx from dynamic template smart service to create dynamic document. It's working with simple table. Now I want to try with if else condition in my template. I am not sure the syntax to use to work with it.Can someone please guide how to do it if we have if/else condition .
Regards,
Shyam
Discussion posts and replies are publicly visible
Pre-compute the flag in expression (ageAbove30: if(r.age > 30, "true", "false")) and pass it in your XML/dictionary.In the template, use: «[#if r.ageAbove30 == 'true']»Above 30«[#else]»30 or below«[/#if]»Each [#if], [#else], [/#if] must be its own separate MergeField.
I tried the same «[#if r.ageAbove30 == 'true']»Above 30«[#else]»30 or below«[/#if]» but r.ageAbove30 is not taking as a boolean ; rather as an extended node+sequence+string and due to the same it's giving the error saying can't compare value of these types.
Try this once«[#if r.@ageAbove30?string == 'true']»Above 30«[#else]»30 or below«[/#if]»