IsTrue – XpressDox

Using the IsTrue function in Document Logic in your XpressDox template

 

When an XML dataset is sourced from a data source, or perhaps from an XML text file which has been populated by user input, it is not always easy to determine beforehand what the format of some data elements will be.  This applies particularly to true/false options which in various scenarios might have values “True”, “true”, “Yes”, “Y” or “1” for a true value.

The IsTrue function will help to address this.  Instead of saying something like:


«If(Option = ‘True’ or Option = ‘true’ or Option = ‘1’ or Option = ‘Yes’ or Option = ‘YES’ or Option = ‘Y’ or Option = ‘y’)»
output some text
«End()»

you can now write it using the following shorthand


«If(IsTrue(Option))»output some text«End()» 

The function is case-insensitive, and so will accept “trUE”, “tRuE”, “yES”, etc. as true values.

The IsFalse() function is equivalent to not(IsTrue()).