/
Templatized Strings

frevvo Latest - This documentation is for frevvo v10.3. v10.3 is a Cloud Only release. Not for you? Earlier documentation is available too.

Templatized Strings

Templates are like variables in your form that will be replaced with the actual values users enter into the form during use mode. Templates make your form feel more interactive and are useful in summarizing information in collapsed section controls. Templates can be used in the form designer in the following control properties:

  • Labels

  • Hints

  • Help

  • Error Msg

Templates can also be used in:

  • Business Rules

  • Form Actions

  • Doc Actions

  • Display Messages

  • Email Action

  • Form Url Parameters _data

Templatized String Syntax

Templates have the syntax: {<control name>}. For example, this form contains three controls labeled "Apples", "Oranges" and "Pears". The controls are named "Q1", "Q2" and "Q3" respectively and would be referenced in a template as {Q1}, {Q2} and {Q3}.

Templates can have default values. The syntax is {<control name>=<default>} For example, this form also contains a control labeled "Total Items in Cart" which is named "T". A template {T=0} would resolve to the value "0" when the field named T is empty otherwise it would resolve to the entered value. 

The Shopping Cart section control contains templates for its Label, Hint and Help.

Help Text
You have {T} items in your cart.<br/> {Q1=0} Apples<br/> {Q2=0} Oranges<br/> {Q3=0} Pears

Before the user starts entering values into this form they will see:

As a user begins entering values into the form fields, the templates will immediately begin appearing, and the user will see:

Templatized String Parameters

Templates support parameters. The syntax is {<control name>=<default value>!<parameter>}. The supported parameter is:

  • encode={true/false} – If encode is false the template is not encoded after resolving it. The default is true 

The encode template parameter is very useful when the template value is a URL. For example, if the template is {svchost}?name={svcps} and svchost has the value http://localhost:8080/, it will get mangled by encoding. Instead use {svchost!encode=false}?name={svcps} and it will not get mangled by encoding.  

Repeat Controls

The template syntax is extended for controls inside repeats. The name of the repeating control must be proceeded with the pipe '|' character. For example if you have a control name Phone inside a repeat, the template must be written as {|Phone}. The result of this template is to output the list of all phone numbers entered into the form.

The default separator is a single space. The syntax also allows for an optional defined separator, such as a comma. If you would like to get the list of phone number items separated by ", " (comma and space), use the following template: {, |Phone}. If you used these templates in a form's Doc Action Display Message and two phone numbers were entered (i.e.. 203.208.3117 and 203.208.3118) you would see this output for those templates:

//default space separator {|Phone} 203.208.3117 203.208.3118 //optional comma and space separator {, |Phone} 203.208.3117, 203.208.3118

Another example is {<br/>|Names} for a control named Names inside a repeat you would see the output:

Joe Nancy James

Configuring a template using the pipe (|) to specify repeats/table rows will not work for the Upload control File Name property.

JSON Array format for Document Action: Send Documents

To include values from repeating controls in Document Actions such as Filesystem Connector or Docuware Connector, the value should be a template string that resolves to multiple values. The recommended approach is to create a template that results in a JSON array using the built-in separator 'json' i.e. {json|controlname}. This special separator resolves to JSON format. The same result can be accomplished by specifying the JSON format i.e. ["{","|controlname}"]. 

Repeat Item Labels

It is very useful to use templates with repeat controls. Imagine a long list of