Attachment File Naming

 

About

Attachments such as images, signatures, and audio files captured through TrueContext can be downloaded or sent to data destinations. They can then be opened as individual files, separate from the rest of your submitted form data. TrueContext names these files with the question's unique ID in order to identify where they are from.

TrueContext also allows you to configure a custom filename prefix to allow you to identify attachments without opening them. This article discusses both the default naming schemes, and how to set up a custom filename prefix for your attachments.

 

 

Default Naming Scheme

Attachments are named based on the attachment question's unique ID. The label is followed by a number. The number increments if there are multiple attachment answers to the question. Attachment filenames are displayed as:

[unique ID]_#.[file extension]
[unique ID]([Row Number])_#.[file extension]

In the case of nested repeatable sections, TrueContext adds another bracketed number to indicate what row of the parent repeatable sectionClosed A Repeatable Section is a subform that contains a set of related questions. The data captured is “repeating”, because the field user can complete the same subform more than once, which creates multiple entries. the attachment comes from.

[unique ID]([Parent Row Number])([Child Row Number])_#.[file extension]

This default naming scheme applies to the majority of file naming at the destination level. This includes documents contained with the "attachments.zip" sent via the API, or downloaded from the web portal. 

Configuring a custom filename prefix will override this default naming scheme.

 

 

Separate File Attachments with a Document

This default file attachment naming only applies when the relevant attachment files are sent separately from the submitted form. This setting is found under File Configuration on the Data DestinationClosed A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats..

The default naming of attachments is controlled by both the control's unique ID and the linked document's designated Data Record Document Filename Expression. Attachment filenames are displayed as:

[Data Record Document Filename Expression]_[unique ID]_#


Or, for Repeatable Sections:

[Data Record Document Filename Expression]_[unique ID]([Row Number])_#

For example, this image filename uses the default naming scheme:

Therefore, the filename is:

20160406-1837674070_Photos 8_1.jpg

 

 

How to Create a Custom Filename Prefix

A custom filename prefix for your attachment filenames allows you to identify the contents of the file without looking at the file itself. For example, DRELClosed Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms. can reference previous question answers using the %a[unique ID] format to create a descriptive name for the file. This will override the Data Record Document Filename Expression, so attachment filenames will be displayed as:

[Custom Prefix Expression]_[unique ID]_#

Note: The custom filename prefix is limited to 140 characters. When using an answer from a form that allows long answers in an attachment name, any answer exceeding 140 characters will be cut off.

Note: When creating a custom filename prefix that will be sent to a cloud destination such as Google Drive or Dropbox, be sure to add a reference that will make each filename unique. Using the reference number (%r[id]) will ensure each attachment filename will be unique, and prevent overwriting of older files with the same name.

To create a custom filename prefix, follow these instructions:

  1. Ensure you are in the correct FormSpaceClosed FormSpaces are where forms are stored and organized in the TrueContext Web Portal. A TrueContext Team may have multiple FormSpaces, depending on their needs. Admins can set FormSpace permissions to control which users have access to the forms in that FormSpace. and select the appropriate form from your list of forms.
  2. Select Edit Form.
  3. On the Pages and Questions tab, create or edit one of the following question types:
  • File
  • Image
  • Audio
  • Signature
  • While editing the question, add your DREL string under the Properties tab, in the Custom Filename Prefix section:
    "Custom filename prefix" in an image question type's properties
  • Save and Deploy the form.
  • Note: When creating a custom filename prefix that will be sent to a cloud destination such as Google Drive or Dropbox, be sure to add a reference that will make each filename unique. Using the reference number will ensure each attachment filename will be unique, and prevent overwriting of older files with the same name.