July 23, 2012

ValueIsEmpty - XpressDox

Normally, the following test would result in “Yes it is empty” if the value of Name were an empty string:

«If(Name = '')»Yes it is empty«Else()»No it is not empty«End()»

However, in situations where the XML data to be used in the template are sourced not from the interview, but from, for example, a data source, then it might be that the data element Name does not even exist in the data set.

In a situation like this, the fillpoint «Name» will result in an empty string being inserted into the merged document, but (because of XML rules) the test Name = '' does NOT evaluate as true, and so the above If/Else construct would render “No it is not empty”.

This is where the ValueIsEmpty function is useful – where there is a possibility that the data element may or may not exist, then the following construct should be used instead of that at the start of this article:

«If(ValueIsEmpty(Name))»Yes it is empty«Else()»No it is not empty«End()»