Additional helpers

Note. The task interface configuration guide describes the features of the HTML/JS/CSS editor. You can also try creating a task interface in Template Builder.

Concatenation

To concatenate two or more strings into a single string, use the {{concat "<string 1> " ... " <string n>"}} helper. Example:

{{#each inputValues}}
  {{field type="input" name=(concat "field_" this)}}
{{/each}}
Copied to clipboard

Object operations

To get the key value from an object, use the {{get<объект> " "}} helper. Example:

{{get inputValuesObj "key"}}
Copied to clipboard

Logical operations and comparisons

Logical operations and comparison operations return either true or false.

To apply a logical operation to boolean values, use the helpers:
  • AND: {{and "a" … "n"}},
  • OR: {{or "a" … "n"}},
  • Negation: {{not "a"}

To compare numeric values, use the helpers:

  • Greater than: {{gt "a" "b"}},
  • Greater than or equal to {{gte "a" "b"}},
  • Less than: {{lt "a" "b"}},
  • Less than or equal to: {{lte "a" "b"}},
  • Equal to: {{equal "a" "b"}}.
    Note. The {{equal}} helper lets you compare values of any data type.

Recording output data field values in JSON

The values of multiple components can be written to the output data field in JSON format.

To do this, specify the output data field in the name attribute of the component and add a unique ID separated by a dot.

For example, the values of the two text input fields are written as JSON objects in the result output data field.

{{field type="input" name="result.input1"}} 
{{field type="input" name="result.input2"}}
Copied to clipboard
The TSV file with responses will contain the following in the result column:
{result {"input1": "<performer's response", "input2": "performer's response>"}}
Copied to clipboard