Using Advanced Expression Piping within your forms you can create mathematical formulas in order to calculate a value. Use SUBSTR to return a set number of characters from a variable. For example, return the first 4 characters from the answer to a question.
The SUBSTR function allows you to return a set number of characters from the variable based on the index positions defined in the second and third values in the expression.
For example, if the applicant provides a 10 digit phone number to question 1, and we want to extract the area code of the number (the first three digits) we can use the expression: {{ SUBSTR(q1, 0, 3) }}. If the applicant responds to the question with 613555555, then the expression will extract and return 613 as the response.
The setup and formatting of the SUBSTR expression is imperative in preventing an error message from appearing on your form where the result of your expression would normally appear. The first line of the SUBSTR expression should be set up as follows:
{{ SUBSTR(identifier, int, int) }} |
The first integer is inclusive therefore this is where the range will start. However, the second integer is exclusive, therefore the range will end with the cell prior.