XpressDox Help Center

Use Google To Find Help Fast, e.g. xpressdox choosefromlist


Press Getting Started in the XpressDox toolbar for basic template development
Watch the tutorial videos
View command help from list of commands
Press F1 for help on a command in the Command Editor
Email support@xpressdox.com for assistance

Concatenating strings


Concatenating strings

A pluralising example

Suppose you have a need to create an XpressDox Variable which will contain either a singular or plural from a data element. Using the example of a Will in Working with repeated elements, we might want to use the word “child” or “children” in many places, and not want to use <<When(count(Child)…>> everywhere, but rather use a variable, e.g. <<GetV(‘childword’)>>.

There are a number of ways of setting the variable “childword” to the required value, but here is one that makes use of the concat function inside a <<SetV>> to concatenate the suffix “ren” to the word “child” when the number of Child data elements is greater than one:

<<SetV('childword','child')>>
<<If(count(Child) > 1)>>
<<SetV('childword',concat(GetV('childword'),'ren'))>>
<<End()>>

Thereafter any execution of <<GetV('childword')>> will put the correct variation of “child” or “children” into the merged document.

A file path example

Another use of the concat function would be to construct a file path given its constitutents. For example, suppose the drive, folder and file name are located in three separate data elements. Setting a variable to contain the full file path would look like this:
<<SetV('FullFilePath',concat(Drive,'\',Folder,'\',FileName))>>

Leave a Reply