Use AEP to do things like:
 Calculate a score for a reviewer ranking
 Perform calculations on values your users enter into your form
 Trigger advanced branching logic
AEP lets you create expressions that use operators or functions to evaluate or manipulate data. The data can come from form responses or passed through metadata variables. Use AEP Syntax to record the result of your expression in your responses or use the output to trigger branching logic.
AEP Syntax: {{ expression }}
 How to Format AEP
 Manipulating User Responses and Answer Selections
 Indexing in Grids and the 3D Matrix
 Indexing a Range
 Using the Score of the Selected Answer
 Creating Expressions with Operators and Functions
In order to set up your expressions on your forms:
 Add an Identifier to your questions that you wish to use within the expression. Setting identifiers to your questions will allow to convert question responses into values.
 Add a new Section Heading, Text Response, or Hidden Field to your form.
NOTE: This will be what the expression is piped into.  If you added a Section heading you will need to create the expression in the question title or description.
If you added a Text Response you will need to create the expression within the Initial Value field.
If you added a Hidden Field you will need to create the expression within the Hidden Value field.  Start your expression by adding 2 curly brackets {{
 Add a space after the second bracket
 Enter your expression.
 After your expression, add a space
 Close your rule with 2 closed curly brackets }}
Manipulating User Responses and Answer Selections
Use responses as values in your expressions. When you use an identifier in an expression, the responses from that question pipes into the expression. Note: question identifiers are case sensitive.
For questions with multiple choice responses, such as a checkbox question, the expression will pass a comma separated list of responses. If you would like to pass a single response, use indexing to specify which value the expression should use.
Indexing in Grids and the 3D Matrix
The syntax to index a particular row in a grid question is: identifier[index]. Where identifier is the question’s identifier and position is an integer indicating the index position of the row. Indexing begins at 0. So the first row in a question will index with q1[0], the second row with q1[1] and so on.
The 3D Matrix has rows AND columns. Grid questions begin their index at the top and move downwards. 3D Matrix questions begin their index in the first row and first column, move left to right across each row, and down to the next row. In a 3D Matrix question with two rows and two columns, q1[3] would index the answer chosen in the second row and second column, as demonstrated in the chart below.
To index a single column in a 3D matrix, use identifier[:columnIndex] where 'identifier' is an identifier and 'columnIndex' is an integer indicating the index position of the column. q1[:0] returns a comma separated list of all values in the first column of q1.
To index a single row in a 3D matrix, use identifier[rowIndex:] where 'identifier' is an identifier and 'rowIndex' is an integer indicating the index position of the row. q1[0:] returns a comma separated list of all values in the first row of q1.
Identifier: q1  Column 1 [:0]  Column 2 [:1] 
Row 1 [0:]  q1[0]  q1[1] 
Row 2 [1:]  q1[2]  q1[3] 
Indexing a Range
The syntax to index a range is identifier[lower:upper] where 'identifier' is an identifier, 'lower' is an integer specifying the index position the range should start at, and 'upper' is an integer specifying the index position where the range should end. Range indexing is lower bound inclusive and upper bound exclusive. This means that your returned values include the value at the position of your lower bound and exclude the value at the position of your upper bound. If you have a 4 row grid question, q1[0:3] will give you the first three values and q1[0:4] will give you all four.
Using the Score of the Selected Answer
The syntax to reference the score of a selected answer rather than the answer itself is identifier.score where 'identifier' is an identifier. You can use score with indexing as well. q1.score[2] gives you the score of the third row in a grid question.
Creating Expressions with Operators and Functions
There are a variety of operators and functions available to manipulate your data and create expressions. For example, you can branch based on whether your users got a high enough score on a given page. To do this, add a hidden field to the end of the page containing your scored question. Then add the following syntax to its Hidden Value: {{ SUM(q1.score + q2.score + q3.score + q4.score + q5.score) >= 3 }} Finally, add a branching rule to branch based on whether the expression evaluates to true or false. The above expression evaluates to true if the sum of the question's scores is greater than or equal to 3.
Click below to see available operators and functions:
Operator  Description  Example Syntax  Example Description 
+  Performs addition  {{ q1 + q2 }}  Sums the values entered into two questions. 
  Performs subtraction  {{ q3[0]  q3[1] }}  Subtracts the input in the second text box from the first input 
*  Performs multiplication  {{ q1 * q2 }}  Multiplies the value entered in q1 with the input into q2 
/  Performs division  {{ q1 / q2 }}  Multiplies the value entered in q1 with the input into q2 
not  Performs boolean logic and evaluates to true or false  {{ not (q1 = 3 ) }}  Evaluates to true unless a 3 is the response for q1 
and  Performs boolean logic and evaluates to true or false 
{{ (q1 > 0) and (q1 < 11) }}

Evaluates to true when a value between 1 and 10 is the response for q1 
or  Performs boolean logic and evaluates to true or false  {{ (q1 > 0) and (q1 < 11) }}  Evaluates to true when a value between 1 and 10 is entered into q1 
=  Is equal to. Evaluates to true or false.  {{ q1 = q2 }}  Evaluates to true when the input to q1 is the same as the input to q2. 
>  Is greater than. Evaluates to true or false.  {{ q1 > q2 }}  Evaluates to true when the input to q1 is greater than the input to q2. 
>  Is less than. Evaluates to true or false.  {{ q1 < q2 }}  Evaluates to true when the input to q1 is less than the input to q2. 
>=  Is greater than or equal to. Evaluates to true or false.  {{ q1 >= q2 }}  Evaluates to true when the input to q1 is greater than or the same as the input to q2. 
<=  Is less than or equal to. Evaluates to true or false  {{ q1 <= q2 }}  Evaluates to true when the input to q1 is greater than or the same as the input to q2. 
!=  Does not equal. Evaluates to true or false.  {{ q1 != q2 }}  Evaluates to true when the input to q1 is not the same as the input to q2. 
Function  Description  Example  Example Description 
SUM(list)  Accepts and sums a list of float or int parameters.  {{ SUM(q1.score,q2.score,q3.score) }}  Sums the scores of three questions 
MAX(list)  Accepts a list of float or int parameters and returns the largest one.  {{ MAX(q1[0:4]) }}  Returns the largest value entered in the first four rows of q1 
MIN(list)  Accepts a list of float or int parameters and returns the smallest one.  {{ MIN(q1[0:4]) }}  Returns the smallest value entered in the first four rows of q1 
AVG(list)  Accepts a list of float or int parameters and averages them.  {{ AVG(q1,q2,q3) }}  Averages the input of three questions 
CONCAT(list)  Accepts a list of parameters and concatenates them. Accepts strings.  {{ CONCAT(q1[0:4]) }}  Concatenates the input to the first four rows of q1 
COALESCE(list)  Accepts a list of parameters and returns the first one with a value in it  {{ COALESCE(q1[0:4]) }}  Returns the first input value in the first four rows of q1 
INT(float)  Accepts a single float parameter and converts it into an integer.  {{ INT(q1.score) }}  Converts the score of q1 into an integer. So a score of 1.0 would become 1 
STR(param)  Accepts a single parameter and converts it into a string.  {{ STR(q1) }}  Converts the input of q1 into a string 
REAL(int)  Accepts a single integer parameter and converts it into a real or floating point number.  {{ REAL(q1) }}  Converts the input of q1 into a floating point. So 1 would become 1.0 
REALTWO(param)  Accepts two parameters, the second must be as an integer indicating the precision to calculate the first parameter.  {{ REALTWO(q1/q2) }}  Divides the input of q1 by q2 and returns a value calculated to the second decimal point. So if q1 = 1 and q2 = 3 it would return 0.33 
PRECISION(param, int) 
Accepts two parameters, the second of which is an integer indicating the precision to calculate the first parameter. 
{{ PRECISION(q1/q2, 2) }} 
Divides the input of q1 by q2 and returns a value calculated to the second decimal point. So if q1 = 1 and q2 = 3 it would return 0.33 
RANDINT(min, max)  Accepts two integers and generates a random number that is between them.  {{ RANDINT(1,100) ))  Returns a random value from between 1 and 100 inclusive. 
INDEXOF(string, string)  Accepts two string parameters and returns the index of the second parameter within the first parameter. If the second parameter is not found in the first, it will return –1. If ‘example’ is one parameter and we're looking for ‘x’ parameter within it, the expression would return 1.  {{ INDEXOF(q1, ‘@’) }}  Returns an index position of ‘@’ in q1 
SUBSTR(string, int, int)  Accepts two or three parameters, the first a string, the second and third integers indicating an index position. Returns the substring from the second parameter onward. The third parameter returns the substring between the two index positions (lower bound inclusive and upper bound exclusive).  {{ SUBSTR(q1, 0, 4) }}  Returns the first four characters entered into q1. 
0 Comments