CreateDataElement function – XpressDox

The CreateDataElement function in XpressDox

The «CreateDataElement()» function will add a new data element to the data set for the template.

When is my new data element available for use?

The data element created by CreateDataElement is not available in the template being run, but will be available to the post-run processes. This means that the new data element will be saved with the data set for the template, for use in future templates. It also means that the new data element is available for merging into file and folder patterns configured in the Standard Folders section of the template folder configurations.

Note that this function does not remove the paragraph on which it appears.

Some examples:


«CreateDataElement('myNewDataElement','Some text')»

«CreateDataElement('myNewDataElement',concat('Matter between ',Plaintiff_Name,' and ',Defendant_Name))»

Another example of the use of this function would be: «CreateDataElement('FileNameFromReference',GetValidFileName(Reference,'-'))». This function call will extract a valid file name from the value of Reference, and assign that value to a new data element called FileNameFromReference. The new data element can then be used in the configuration for the template folder Standard Folders as a file-or-folder name pattern without the fear that a user might enter an illegal file name character when capturing a value for data element Reference.


Syntax change in v14:

The syntax of this function changed slightly in v14.

In the past, the data element created inside this function was the only exception to the rule of data elements not being enclosed in quotes. From the above example, you will see the new data element that was created ‘FileNameFromReference’ is enclosed in quotes.

But from v14 onwards, it is no longer necessary to enclose the data element in quotes. It is not wrong, but no longer necessary.

«CreateDataElement(NewDataElement,'A string value')» where the text value is enclosed in quotes.

«CreateDataElement(NewDataElement,ValueFromDE)» where you are assigning the value from another data element to this new data element, following the rule that data elements never appear in quotes, but text does.