October 1, 2009

SetSavedDataFileName - XpressDox

Classic Usage

Much like the SetSavedDocumentFileName command, the «SetSavedDataFileName()» command not only ensures that the answer set is saved, but also how it should be named. Regardless of whether the user checks the Save Merged Document? check box on the data capture interview for that template, this command forces the data to be saved in an xml file, making it retrievable at a later stage for re-use in subsequent templates which use the same data element names.

Here is an example of this command:

«SetSavedDataFileName(<TemplateName> for <ClientName>)»

Note the <> characters around ‘ClientName’ – these indicate that XpressDox must extract the value of the ‘ClientName’ data element captured in the interview, and use that value to construct the file name.

<TemplateName> is a system specified value and is used to insert the name of the template in the file name. It does not have to be defined anywhere but must be enclosed in <>. Note that all data elements referenced in this command must be enclosed in single <>.

The resulting file name for the data set in this example would be ‘Account for J. Jenkins’ assuming that my template name is Account and the value for ClientName as captured into my interview is J. Jenkins. The next time a document needs to be assembled for that client, making use of the ‘Use Other Data’ button on the interview, a user can retrieve the previously saved data set instead of entering that client’s details again. The file path of the saved data sets can also be determined in the template using the SetSavedDataFolder command, and this would be the folder that the XpressDox explorer would open upon clicking on ‘Use Other Data’.

The forced saving of data can also be defined in the Configuration, meaning that the template author would not need to use this command on each template. Any Configuration settings which determine the naming convention of the data, however, would be overwritten by this command on the template.

Note: there are a few other “merge field” names that can be used in the <> syntax:

<WindowsLogonUser>: gives the user name with which the user logged on to the PC.

<XDSaveDate>: this will return the current date in format yyyyMMdd.

<TieBreak>: is the time of day, equivalent to Now(‘ddHHmmssff’) – in other words, the day of the month followed by the time in hours, minutes, seconds, and hundredths of a second.

Function-like Usage

With effect from version 5.3, the command can be coded as if it were a function, for example:

«SetSavedDataFileName(concat('Data for ',GetValidFileName(AccountNumber)))»

This would ensure that even if the AccountNumber data element had illegal characters for a file name (e.g. ‘\’ or ‘:’) the result would nonetheless be a valid file name.