@FILENAME

Sets the filename of the generated document when it is downloaded

Usage

<# @FILENAME(name) #>

Parameters

name

(Required) The name to use for the generated document

Examples

Example With these variables Result

<# @FILENAME(CONCAT(“Presentation “, country)) #>

country is "Canada"

File name when downloading: Presentation Canada

More information

This action does nothing to the document itself; it gets erased when generating a document.

This name is used as an initial/default filename when downloading a generated document that did not have any error.

DocuMold will add the .docx at the end of the name if it’s not already there.

When @FILENAME is not in the document, the generated document’s name will be the name of the initial file (the template) with a timestamp. For the file Contract Template.docx, it would generate Contract Template_20240203_134620.docx.

To be used, the @FILENAME action must not be hidden by a @IF action.

If @FILENAME is present multiple times in a document, the last one (lowest in the document) that was not hidden by a @IF action will be used.

Different names

Depending on the values given in the form, you may want different names for the file. There are many ways to do that:

  • Use the @IF/@ELSEIF/@ELSE actions with a distinct @FILENAME in each content. The last non-hidden @FILENAME will be used.
  • Use variable(s) and function(s) in the @FILENAME. The IF function gives lots of possibilities.

Other

When an error occurs, @FILENAME will be ignored when generating a document with errors as a comment.