Data Record Expression Language (DREL)

 

About

The Data Record Expression Language can be used to build a string using properties from the Data Record, including answer data. DREL is most commonly used for:

Any number of references can be combined to create longer custom strings dynamically generated from your data, and they can be combined with static text.  

Samples:

  • %d - %a[Customer Name] - %a[Priority]  -- Could create a string like: 2014-05-30 - John Doe - Urgent
  • %r[id] - Work Order - %a[Company Name] -- Could create a string like: 1812345 - Work Order - Company ABC
  • %t[HHmm] - %a[Street Address] -- Could create a string like: Store Visit - 14:15 - 123 Avenue Street

A number of variables can be used to insert dynamic data from the Data Record into the string.  These reference properties have a default value, but other properties can specified by using [] syntax following the % reference. For example, using the reference %u would by default insert the user’s display name into the string, but  modifying the reference with the email property ( %u[email] ) would insert the user’s email address instead.

[ top ]

 

Referencing Form Metadata

A number of data record metadata fields can be referenced with DREL.

Data Record Properties

Reference: %r   |  Default:  referenceNumber  |  Other:  id

  • referencenumber is the Data Record Reference Number, which  is the ProntoForms system's unique identifier for a submitted data record.  It is also shown beside each data record listed in the "Data Records" page in the web portal.  The reference number is composed of a string identifying the date the data record was submitted,  followed by the Data Record Identifier, in the format "yyyyMMD-##########." For example, a data record submitted on June 20, 2014 could have the reference number "20140620-1811278959."  
  • id is the Data Record Identifier (the second part of the Data Record Reference Number).  This number is always unique. 
  • These values can be useful when a unique identifier is required, such as in the case of an invoice number.

[ top ]

 

FormSpace Properties

Reference: %s  |  Default: name  |  Other:  id

  • The name or id (unique numeric identifier) of the FormSpace the form is in will be referenced.  
  • This can be very useful for teams that have a FormSpace for each region or business function; referencing this in the Folder Expression of a cloud service data destination would allows organizations to sort their forms by FormSpace.
  • Standard Tier teams have one implicit FormSpace called "All Forms."

[ top ]

 

Form Properties

Reference: %f   |  Default: name  |  Other:  id

  • The name or id (unique numeric identifier) of the form the data was submitted against can be referenced.
  • This is one of the most commonly referenced properties; it is very commonly referenced in Data Record Naming, and in Data Record Document Filename Expressions.

[ top ]

 

Form Version Properties

Reference: %v   |  Default: version  |  Other:  id

  • The version or id (unique numeric identifier) of the form version the data was submitted against can be referenced.
  • If the form version is v2, the output from %v or %v[version] will be simply "2".

[ top ]

 

User Properties

Reference: %u   |  Default: displayName  |   Other:  id   |  username  |  name  |  email

  • These properties reference the information of the logged in user who submitted the data record.
  • displayName is the user's name and username, in the format "John Doe (johndoe@abc.com)."
  • id is the user's unique numeric identifier in the ProntoForms system.
  • username is the string the user logs in with.
  • name is the user's first name and last name, as configured in their user profile in the ProntoForms web administration portal.
  • email is the user's email address as configured in their user profile in the ProntoForms web administration portal.

[ top ]

 

Date

Reference: %d   |  Default: %d[yyyy-MM-dd] 

Typical Date Formatting Syntax:  yyyy (Year)  |  MM (Month)  |   dd (Day)

  • The date property by default references the full date at form completion, collected when the form is submitted.
  • With default formatting, the date would appear like "2014-07-02."  
  • You can optionally configure the format of the date, using the [ ] syntax and additional static formatting.
  • For example, using "%d[E MMMMMMMMM dd, yyyy]" would create a string like "Wed July 02, 2014." 
  • Read here for the full allowed syntax.

[ top ]

 

Time

Reference: %t   |  Default: %t[HH:mm:ss zz]

Typical Time Formatting Syntax: HH (Hour[24 hour syntax])  |   mm (Minute)  |  ss (Second) | zz (Timezone)

  • The date property by default references the full date at form completion, collected when the form is submitted.
  • With default formatting, the time would appear like "11:57:41" (24 hour time).
  • You can optionally configure the format of the time, using the [ ] syntax  and additional static formatting.
  • For example, using "%t[hh:mm a zz]" will format the date like "11:57 AM EST."
  • Read here for the full allowed syntax.

[ top ]

 

Referencing Questions and Answers

This section discusses referencing questions and answers in forms that do not contain structured or repeatable sections. Learn more about referencing questions and answers in repeatable sections.

Referencing Question Text

Reference: %q[QuestionLabel]

This reference is used to insert the text of a question with a label matching the text in [ ]. Question labels are most easily found in the form builder, in grey to the right of the question. Learn more about using Labels.

 

Referencing Answers

Reference:  %a[QuestionLabel] 

This reference is used to insert the answer to a question with a label matching the text in [ ].  Question labels are most easily found in the Form Builder, in grey to the right of the question.   Learn more about using Labels.  

For example, the DREL strings required the reference the answers to the questions below would be "%a[customer name]" and "%a[total value]."

 label.png

[ top ]

 

Data Types with Multiple Properties

Some question data types contain multiple properties.  To specify the property to output, use a second [ ] section. For example, to output a file's content type, use %a[FileLabel][contentType]. When no property is specified, the default property is output. To specify fallback properties, use a : to separate the properties. For example: %a[GeoLabel][address:errorMessage].

Geo Location Data Properties

Default: address:coordinates  

Other:  success (successful acquisition indicator) |  geoSource  (acquisition method)  |  timestamp  (time of acquisition) |  coordinates  |  coordinates.latitude  | coordinates.longitude  |   address (resolved address from coordinates) |   errorMessage (reason for acquisition failure)

Note: "Coordinates" contains 3 strings: latitude, longitude, altitude.

[ top ]

 

Attachment Data Properties

Default:  filename    |   Other:  contentType |  bytes  (Attachment bytes [Encoded in Base64]) 

[ top ]

 

Barcode Data Properties

Default: barcodeValue   |    Other:  barcodeType

[ top ]

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

Comments