The SetSavedDocumentFileName Command
«SetSavedDocumentFileName()» command not only ensures that the merged document 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 document to be saved.
If you, as template author, want the merged document to be saved, then just set the document file name with the «SetSavedDocumentFileName()» command, and the merged document will be saved automatically by XpressDox.
Here is an example of this command
«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,'-')))»