# Set Value Rules

*NEW FUNCTIONALITY - COMING SOON!*

**CONTENTS**

**How to write a set and clear rule**

# What is a set value rule?

Set value rules auto-populate a specific value for a task response if certain conditions are met. These can be numeric values or text values based on the task type. For example, a count task must be given a numeric set value response and a short answer task must be given a text response.

Set value rules can include:

- a static text value that will be submitted as a task response
- a static numeric value that will be submitted as a task response
- a dynamic text value that concatenates values from multiple task responses
- a dynamic numeric value that calculates values from multiple task responses
- a defined text or numeric value for a
**variable**

Additionally, advanced logic rules can be written to **set and clear** task responses, meaning that if a specific condition is not met, the provided task response value will be cleared and set to a specified value when the mission response is submitted.

# How to write a set value rule

In the advanced logic text editor, rules will be grouped under the **set value **category if they leverage **SET VALUE **in their action statement.

To write a set value rule:

- Navigate to the mission builder
**logic tab**: - Review the mission structure in the
**structure panel**and use**applicable abbreviations**to reference a task or section within a rule. In this example, Task 1 (T1) and Task 2 (T2) ask for a count. Task 3 (T3) asks for a total count. A set value rule can be used to automatically populate the total count as a response for Task 3 (T3), summing the values of Task 1 (T1) and Task 2 (T2).

Rules must contain a condition, action, and event. The example rule is defined as follows:

Condition |
Action |
Event |

IF ALWAYS | THEN SET VALUE T3 TO T1 + T2 |
ON RESPONSE |

*Translation: Always set the value of Task 3 (T3) to the sum of responses to Task 1 (T1) and Task 2 (T2) as the responses to T1 and T2 are submitted. *

For more information on advanced logic rule syntax, **click here**.

# How to write a set and clear rule

A set and clear rule can provide a set value for a task and clear out that value if the original condition is no longer met (e.g., if a user changes the answer that triggered a set value, the set value will be cleared). Set and clear can also be used to overwrite or change a selected answer to a different value.

To write a set and clear rule:

- Navigate to the mission builder
**logic tab:** - Review the mission structure in the
**structure panel**and use**applicable abbreviation**s to reference a task or section within a rule. In this example, Task 2 (T2) should only be answered if Task 1(T1) is answered ‘Popcorn’ (A2.). This set and clear rule will clear out any answer provided in T2 and set the response to null (or blank) if T1 is answered ‘Chips’ or ‘Crackers’.

Rules must contain a condition, action, and event. The example rule is defined as follows:

Condition |
Action |
Event |

IF NOT T1.A2 | THEN SET AND CLEAR T2 TO NULL |
ON RESPONSE |

*Translation: If Task 1 (T1) is not answered with answer option 2 (A2), clear any response value given in Task 2 (T2) and set the response to null.*

For more information on advanced logic rule syntax, **click here**.

# Set value use cases

Use Case |
Example Rule Syntax |
Mobile User Experience |

Set a string value as a task response | IF ALWAYS THEN SET VALUE T1 TO ‘Example Answer’ ON RESPONSE | User will have ‘Example Answer’ auto-populate as the response to Task 1. |

Perform arithmetic to set a response value for a task | IF ALWAYS THEN SET VALUE T3 TO T1 + T2 ON RESPONSE | User will have the sum of their responses given to Tasks 1 and 2 automatically populate as the response value to Task 3. |

Set value for a variable used in a calculation rule | IF ALWAYS THEN SET VALUE ‘example_variable’ to ‘Example Value’ ON START | User will see ‘Example Value’ wherever the variable has been piped into the Mission. |

Set and clear a given answer to a different string value | IF T1.A1 THEN SET AND CLEAR T2 to ‘Example Value’ ON RESPONSE | If a user answers Task 1 with answer option 1, Task 2 will auto-populate with ‘Example Value’, overwriting any other answer given. |