DREL Documents

Available on the Advanced and Enterprise tiers:

Essentials
Advanced
Enterprise

About

Create custom documents in any format to pull data from your submitted forms. Using TrueContext Data Reference Expression Language (DREL), you can build a document to display information in easy-to-read formats. This could be used to generate a custom XML format or a custom HTML invoice, 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. is a TrueContext-specific language that is used to reference data in submitted forms (data records). It can be used to build a string using properties from form submissions, including answers. Read here for full details of the properties that DREL can reference.

A number of other document types are available, and multiple documents can be sent with a single form submission. Read more about documents here.

Settings

Create the document, select DREL as the document type, then follow the instructions below.

DREL option for document creation

Document Basics

Name/Description

Give the document a unique name. Optionally provide a description.

Filename

This name applies to all instances of the document, including downloaded documents and documents sent by Data Destinations.

Tip:A recognizable file name can help you quickly search for and identify files when:
  • You download files from multiple form submissions so that you can work locally.

  • You or your customers receive multiple messages generated by Email Destinations.

  • Use Data Reference Expression Language to reference answers in your forms.
  • Static text can also be included.
  • For example, %r -- %a[Customer Name] would name the file like "20140812-180001002 -- John Smith."

filename.png

Tip:A recognizable file name can help you quickly search for and identify files when:
  • You download files from multiple form submissions so that you can work locally.

  • You or your customers receive multiple messages generated by Email Destinations.

  • Some data destinations will overwrite files with duplicate names. Make sure file names are unique by including one or more of:
    • %r - the submission's reference number -- e.g. 20140920-1815562464
    • %r[id] - the submission's ID - e.g. 1815562464
    • %t - the time the form was submitted

Document Timezone Source

Choose a document time zone source. This is the time zone for all dates and times in your document.

  • Team Preference Setting: Will use the time zone chosen for the team
  • Data Record: Will use the time zone the form submission is made from (as chosen on the mobile device).
  • Custom: Choose a time zone.

Document Time Zone Source

Auto-Link new forms to this document

Selecting this option will add the document as an "Additional Document" to forms created or imported after this option is set. Submissions made against these forms will be downloadable in this document format from the "Data" tab of the portal.

autolink.png

DREL Template Configuration

File Extension

The document can be any text-based file type (HTML, .txt. .xml, etc).

Content Type

Leave this blank for automatic resolution based on file extension.

DREL Template

Paste your DREL Template (whether hand-written or created through a WYSIWYGClosed What You See is What You Get. The input looks similar to the output. editor) into the text box. You can use a combination of static text and Data Reference Expression Language. Line breaks will be preserved.

dreltemplate.png

Info:We recommend that you escape the data for all JSON, XML, HTML, and CSV documents. This ensures that the system generates a valid document in your selected format.

HTML & DREL Template

Display your data in a user-friendly way by creating a custom-formatted HTML document that can look exactly like your paper forms. Your customers can see something familiar, while you can still route data to any other data destination, such as your back-office systems.

invoice_example.png

Building and Testing Custom HTML/DREL Documents

  1. Build your desired output in HTML using a third-party WYSIWYG editor or raw HTML, adding placeholders for where you want your submitted form data to go. If using a WYSIWYG editor, remember that you must copy/paste the HTML into the "DREL Template" box.
  2. Map the answers to questions using DREL - %a[QuestionLabel] - as demonstrated below. Keep in mind that if you're using the same document with multiple forms, it's best to have consistent question labels.
  3. Attach the document to either a test copy of your form, or attach it as an additional document available to download on a production form to ensure that the documents are not accidentally sent to incorrect recipients.
  4. Submit several form submissions.
    • Check that all the data you want to show up has done so in the right place.
    • See what happens with empty fields - do they cause strange row collapses or other layout errors?
    • Fill out every field with the longest input likely to happen to test maximum width limits and word-wrap.
    • Fill out every field with the shortest input likely to see how the document looks.

Note: When referencing images or sketches (photo, signature, or sketch pad questions) in a DREL template, you must do more than simply add %a[Question Label]. To reference images in a document, use the <img> tag in HTML combined with correct references.

<img  src="data:%a[Question Label][contentType];base64, %a[Question Label][bytes]"> 

Please note that questions collecting multiple attachments will not work in the custom document. Only questions collecting a single attachment will work.