Related topics:


Tutorial Videos

Tutorial videos are available here.

Knowledge Base

Visit our User Forum for discussions & solutions

Format – XpressDox

When concatenating strings together (see Concatenating Strings), it is not always easy to visualize what the end result will look like. This is especially the case when the strings being concatenated are a mixture of fixed text and values of data elements and functions.

This situation often arises when using CreateDataElement to build up a data element to be used, for example, as a file name.

Take this example, using the concat function:

«CreateDataElement('OutputFileName',concat('Invoice - ',GetValidFileName(AccountNumber,'-'), ' - ', Today('yyyyMMdd')))»

This will create a data element called ‘OutputFileName’ and put something like “Invoice – A0001-99 – 20150717” into it.

Using Format rather than concat, the fillpoint would look like this:

«CreateDataElement('OutputFileName',Format('Invoice - {0} - {1}',GetValidFileName(AccountNumber,'-'), Today('yyyyMMdd')))»

The codes ‘{0}’ and ‘{1}’ are insertion point markers, and refer to the first and second insertion parameters after the format string, respectively.

You can have up to 10 insertion point markers, i.e. {0}, {1}, {2}, … {9}, as long as there is a matching parameter (after the format string) for each insertion point marker.

You can repeat an insertion point marker, which will repeat the occurrence of the inserted string, and the insertion point markers can be in any order in the format string, as long as they correspond to the position of the relevant insertion parameters.

The above is all rather complicated to specify formally, but try it and see – it’s very easy to use.