«SetSavedDocumentFileName()» command not only ensures that the merged document is saved, but also how it should be named.
In the desktop (Word) version of XpressDox, there is a checkbox for the user to choose whether or not to save their assembled document. But regardless of whether the user checks that Save Assembled Document? check box, this command forces the document to be saved. In the web version, all assembled documents are saved, and this command enables the template author to specify a better name for that document.
«SetSavedDocumentFileName(<TemplateName> for <ClientName>)»
Note the <> characters around ‘ClientName’ – these indicate that XpressDox must extract the value of the ‘ClientName’ data element captured for the template, and insert that value into 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 in the 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 forced saving of documents can also be defined in the Configuration which would mean that the template author would not need to use this command on each template. Any Configuration settings which determine the naming convention of the document would be overwritten by this command on the template.
The file path of the saved documents can be determined in the template using the SetSavedDocumentFolder command.
With effect from version 5.3, the command can be coded like a function. For example, the above would be rendered:
«SetSavedDocumentFileName(concat('Agreement for ', ClientName))»
Even more useful is the fact that, amongst others, the GetValidFileName function is directly available. That means if the ClientName data element value might contain characters which are illegal in a file name (like ‘:’ or ‘/’) then a valid file name can be rendered quite easily with:
«SetSavedDocumentFileName(concat('Agreement for ', GetValidFileName(ClientName,'-')))»