Advanced file handling

As well as configuring the folders where documents and data are to be stored, the filename which will be given to the saved documents and data can be defined, using the ‘Pattern for saved file name’ described in configuring standard folders.

In addition to all of that, the template author has features which give even more fine-grained control over where documents and data are stored. These features relate closely to the file locations which can be configured.

The features are controlled by the template commands SetSavedDocumentFolder, SetSavedFileName, SetSavedDataFolder and SetDocumentName.

a. SetSavedDocumentFolder. This command, as with the others explained here, is entered in the template itself, for example: «SetDocumentSaveFolder(Documents\<AccountNumber>)»

If the DocumentSaveFolder set in this way is a relative folder, as with this example, then the folder configured into the Document Save Folder is prefixed in order to arrive at an absolute folder path.

Note the <> characters around ‘AccountNumber’ – these indicate that XpressDox must extract the value of the ‘AccountNumber’ data element captured for the template, and insert that value into the folder name, giving a result, in this example, of ‘Documents\AA000123’ (assuming the ‘AccountNumber’ captured was ‘AA000123’). Data elements enclosed in <> are called File Path Merge Fields.

There are three system values that can be specified as File Path Merge Fields for the advanced file handling features, namely TemplateName, DocumentName and WindowsLogonUser.

i. TemplateName is the name of the template file, excluding the path and the file extension. If the full path of a template is, say, ‘C:\Documents and Settings\Fred\Templates\LetterToMom.xml’ then the TemplateName File Path Merge Field will have the value ‘LetterToMom’.

ii. DocumentName is set by the template author using the SetDocumentName command within the body of the template.

iii. WindowsLogonUser is the user name under which the user logged on to Windows.

b. SetSavedDocumentFileName. A file name specified with this command will override the ‘Pattern for saved file’ in the configuration, if any. The saved file name can be a relative or an absolute path. In the former case it is made absolute by applying either the path specified in a SetSavedDocumentFolder (on the same template) or, if that is not specified, the configured Document Save Path.

An example would be: «SetSavedFileName(<DocumentName><PartyName>)»

c. SetSavedDataFolder. This command can be used to override the configuration setting of Data Save Folder. The use of File Path Merge Fields and absolute and relative path naming are as described for the other commands in this section.

Note that the file name for the data is always the same name as was applied to the merged document, but with the extension ‘.xddata.xml’ instead of ‘.xml’.

d. SetSavedDataFileName. This functions in much the same way, for data file names, as SetSavedDocumentFileName functions for merged documents.

e. SetDocumentName. This command enables setting a document name which can then be used to merge into a file name or folder name as the <DocumentName> File Path Merge Field.

It should be apparent that the Advanced File Handling features provide a powerful means towards designing a document production and management system which has many of the features of purpose-designed systems, but with the simplicity of being defined and managed by the users.