IF condition ODT tags.

Hi,
I would like to put conditional on payment terms to be displayed on invoice.

Scene :
In invoice if Bank reference = “xyz”
then print “pay to xyz bank”
else if bank refernce = “abc”
then print “pay to abc bank”
endif

Example: Wiki ODT document doesn’t have clear picture.

[!-- IF {my_var} --]
Print this text if {my_var} is true (can be any value but null/0/empty string)
[!-- ELSE {my_var} --]
Or print this if it’s false (null/0/empty string)
[!-- ENDIF {my_var} --]

where does my_var comes from?
How to construct the if statement using my scene.
Thanks.

any update ?

Hi,

my_var is usually and extrafields that you can add in each document.

What are the xyz and abc condition is it a reference to an object extrafield or a line extrafield.

The syntax in your case should be

[! - - IF {xyz} - - ]
{object_options_xyz}
[! - - ELSE {xyz} - - -]
{object_options_abc}
[! - - ENDIF {xyz} - - ]

Hope this helps

@h6585,

In my above quest,
xyz and abc are bank reference on invoice card.

we deal with multiple banks, so if user select bank reference as xyz, then bank details of xyz should be printed or if bank reference is abc, print abc bank details. this is the quest.

Please check the attached photo.

I want to use if statement to check bank account and display bank details according to the each selection.
thanks.

Hi,

You create a list that, as far as I know, it is incompatible with IF statement.
In IF statement of OTD you need fals or true information.
So better to create two check boxes and use the IF statement of h6585

This is what I did and solve on testing environment… need to test on production environment.

I created 2 complimentary fields in Invoice -

and then in odt template i added this -

[!-- IF {object_options_bbank} --] 
Bank - 1
[!-- ELSE {object_options_bbank} --]
[!-- IF {object_options_cash} --]
Cash
[!-- ELSE {object_options_cash} --]
Credit Card
[!-- ENDIF {object_options_cash} --]
[!-- ENDIF {object_options_bbank} --]
1 Like