November 27, 2014

IIf - XpressDox

This function is a kind of short cut to writing «If()»«Else()»  … «End()» in certain circumstances.

 

Using If.. Else.. End:

Suppose you want to write something like

The amount of VAT applicable is ….

Where the …. above is either zero, if no VAT is applicable, or is Amount * VatPercentage div 100.

Using the If command that would be:

The amount of VAT applicable is «If((VatApplicable = 'Yes')»«FormatNumber(Amount * VatPercentage div 100)»«Else()»0.00«End()».

 

Using IIf:

You could combine those all into one fillpoint like this:

The amount of VAT applicable is «IIf((VatApplicable = 'Yes'),FormatNumber(Amount * VatPercentage div 100),'0.00')».

 

This function, the Inline If, gets its name from the Basic language function which operates in a similar fashion.

 

Related articles:

Conditional processing

Learn more about conditional logic here.