DREL Documents

 

About

Create custom documents in any format to pull data from your submitted forms. Using ProntoForms' Data Record 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. An example of using DREL to create a custom output is available in: Creating a Custom Word Document using the ProntoForms DREL Document.

DREL is a ProntoForms-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. 

 

admin.pngnouser.pngnomobile.png

Settings

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

DREL.png

 

Document Basics

Name/Description

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

Filename

This is the name of the file that will be sent through data destinations.  

  • Use Data Record 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

  • 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

[ top ]

 

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.

timezonesource.png

 

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

[ top ]

 

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.  Read here for a list of content types.

DREL Template

Paste your DREL Template (whether hand-written or created through a WYSIWYG editor) into the text box.  You can use a combination of static text and data record expression language.  Line breaks will be preserved.  

dreltemplate.png

[ top ]

 

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 WYSIWYG editor (external link) 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.

[ top ]

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Alexander Dehn

    I have some questions:

     

    1. Where I bind  submission's reference number to document.

    2. In this sample image of invoice has 3 detailed rows, but template has 7,  how there related each to other?

    is "standard invoice" has repetable section? are "Producr/Service 1(2,3,4,5,6,7,)" indexed QuestionLable of  "standard invoice" with repeatable area.

     

    Thank you.

  • Avatar
    Danielle Morley

    Hi Alexander,

     

    In the above example,   the template accomodates 7 rows, but only 3 "Products" were entered into the form submission, therefore there was no data to map into the additional rows.  The HTML template in the sample was probably set up to "collapse" any empty rows in the table.

    The form we used did not have repeatable sections.    However, you should be able to accomplish this with repeatable sections as well -- there is just different DREL to use to reference answers from repeatable sections.  Read here for more info:  https://support.prontoforms.com/hc/en-us/articles/217831408-DREL-for-Repeatable-Sections