How can I choose the exported filename?

By default, when a user exports a questionnaire to DOCX or PDF, ClauseBase assigns a filename that is equal to the filename of the underlying document. In many cases, this will be fine, but in some cases you will want to either dynamically define the filename, or even let the end-user choose the filename.

Step 1: Create a question that asks for the filename

Create a text-based question that asks for the filename. This question can act like any other text-question, e.g. have predefined options, a different answer per language, etc.

You can also subject the question to various conditions, but please take into account that a disabled question will not be taken into account when the software calculates the filename. Note that this means that you can use different filename-related questions, and only active one of them, depending on certain user answers.

Step 2: Assign the “export-filename” tag to that question

In the question’s options, assign tag “export-filename” in the “other tags” section of the settings. (If you do not see this button, then you should contact your administrator, because you have insufficient rights.)

Tip: you may also want to tick the “do not show this question” option. This will cause the question to be active (and thus change the exported file’s filename), but simply not be visible towards the end-user.

This can be useful if you want to dynamically calculate the filename, but not let the end-user interfere with this calculation.

Optional step 3: insert dynamic fields in the answer

The question’s answer will become the exported filename — so if the answer to that question is “employment agreement John”, then that piece of text will be used.

Do not insert the filename’s extension (e.g., “.docx.” or “.pdf”), as it is automatically added by the software.

You can, however, also integrate dynamic parts into the filename.

Integrating the current date

You can integrate the current date — shown as 2020-11-22 to allow for easy sorting on your computer’s filesystem —by simply inserting {date} into the answer.

If you would like to format the date, then you can insert the date formatting configuration before the closing curly brace. The options you can use, are identical to the options allowed by @format-date. For example, {date yyyy} would insert the year with 4 digits. Another (quite nonsensical) example to drive the idea home: inserting {date dotted-yy-mm-comma} would insert the the year with two digits, followed by a dot, followed by the month with 2 digits, followed by a dot, followed by a comma.

Integrating other questions’ answers

You can also integrate the answer to other questions, by inserting {identifier} into the answer, whereby identifier refers to the identifier of a certain question.

This identifier is set in the question’s options, in the section .

Note that if you refer to a question that happens to be disabled, then the { … } part will simply be removed.

If you refer to questions that are not text-based (e.g., a duration, date or true/false question) then the software will try to convert that answer into text.

Example

In an employment agreement, you could create a (non-visible) question with a default answer set to Employment contract {first-name} {last-name} {date} , whereby the first-name and last-name are the identifiers of two other questions that ask for the user’s first name and last-name.

As another example, you could have a question that sets the filename to either predefine Addendum to {main-agreement-name} or predefine {main-agreement-name}, depending on whether the user is creating an addendum to an existing agreement, or an entirely new agreement.

Was this article helpful?
Dislike
How to: create a question to change the language of a document in a Q&A
How to: create categories of questions in a questionnaire