Follow email Print print

Advanced Logic Overview

 

CONTENTS

What is advanced logic?

Advanced logic rules

Advanced logic syntax

Use cases


What is advanced logic? 

Advanced logic allows Missions to be more dynamic and customizable.  With advanced logic, rules can be added within the mission builder to:

  1. establish dynamic tasks that can be shown or hidden based on specific criteria
  2. define a set value for a particular task response
  3. perform calculations on task responses
  4. add dynamic information (known as piping) to mission instructions, sections, and tasks 

Advanced logic is available to all Enterprise and Pro-Package customers. If your company has advanced logic enabled, a logic tab will appear within the mission builder

Advanced logic tab

Advanced logic rules

Within the logic tab, a text editor allows mission builders to write advanced logic rules. These rules consist of three components: conditions, actions, and events.

Conditions

A logic statement’s condition defines a scenario that triggers a rule. A condition is provided with an IF, IF NOT, or IF ALWAYS statement at the beginning of a rule. 

  • IF indicates that if the specified condition is met, the rule will be triggered. 
  • IF NOT indicates that if the specified condition is not met, the rule will be triggered.
  • IF ALWAYS indicates that the rule should always be triggered. 

Actions 

An action is a behavior that should occur if the stated condition is met. Actions can apply to a single task, range of tasks, single section, range of sections, answer options on multiple choice/multiple select tasks, or a range of answer options on multiple choice/multiple select tasks. Supported actions include: 

  • SHOW: Show tasks, sections, or multiple choice/multiple select answer options. 
  • HIDE: Hide tasks, sections, or multiple choice/multiple select answer options.
  • SET VALUE: Insert a task response value based on the defined logic.
  • SET AND CLEAR: Insert a defined task response value and, if the condition is not met, clear out the given response.

Events

Events specify when the rule should be triggered. There are three supported event types:

  • 'ON RESPONSE' specifies that the rule should be executed as task responses are submitted on the mobile device. These rules update the Mission in real-time prior to a full mission response submission. 
  • 'ON MISSION' or 'ON START' specify that the rule will be enforced as soon as the Mission begins. This means that the mission structure will not update in real-time based on specific task response submissions, rather, the rules will be evaluated and finalized when the Mission is started. 
  • 'ON MISSION AND RESPONSE' specifies that the rule will be enforced as the Mission begins and reevaluated as responses are submitted.

For an in-depth overview of the advanced logic editor, click here. 

Advanced logic syntax

The advanced logic editor is designed to accept abbreviations for sections, tasks, and answer options. 

Example abbreviations in the advanced logic editor 

Abbreviations

The structure panel provides the required shorthand abbreviations for a specific section, task, or answer option.  

  • Sections: Sections are listed in alphabetical order and defined by the letter S. For example, the first section of a Mission is denoted as SA. The second section of a Mission is SB.
  • Tasks: Tasks are listed in numeric order and defined by the letter T. To reference the first task in the first section of a Mission, the accepted syntax is SA.T1.
  • Answer options: Answer options are listed in numeric order and defined by the letter A. To reference an answer option, the accepted syntax is Section.Task.AnswerOption. For example, SA.T4.A1 refers to the first answer option on the fourth task in the first section of a Mission.

For an in-depth overview of advanced logic rule syntax, click here

Task Identifiers

The mission builder allows tasks to be given unique identifiers. These identifiers can be used in advanced logic rules rather than abbreviating a task numerically. Identifiers must be unique and cannot match the naming convention of any other object within the Mission (e.g., ‘Mission’ is a reserved word that cannot be used as a task identifier). 

A task identifier can be added within the mission builder’s task configuration panel. Click on a task and the panel will appear on the right-hand side of the screen. In the example below, the first task (T1) in the first section of the Mission (SA) has an identifier of oranges_count. In an advanced logic rule, oranges_count and SA.T1 can be used interchangeably. 

Sample task identifier referenced in an advanced logic rule

Read more on task identifiers here

Use cases

Dynamic Tasks

The mission builder allows conditional tasks and subtasks to be shown based on specific answer submissions, but some use cases for conditional logic require more flexibility than standard parent/child task relationships. Advanced logic provides the ability to write customizable rules that dynamically update the mission structure as needed for your organization. 

Dynamic tasks show or hide:

  • A single task or a range of tasks
  • A single section or a range of sections
  • A single multiple-choice answer option or a range of multiple-choice answer options
  • A single multiple-select answer option or a range of multiple-select answer options

With dynamic tasks, Missions can update in real-time based on incoming task responses, the user submitting the response, or the place where the response is being completed. 

Dynamic Task Example:

In this example, if the first task (T1) within the first section (SA) of the Mission is answered with a value that is greater than 12, this rule will dynamically hide the fourth task (T4) within that same section. If the response to the first task (T1) is less than 12, the fourth task (T4) within Section A (SA) will not be hidden. 

For a rule to be considered a dynamic task, it must include the verbs show or hide in its action statement. 

For more on how to create dynamic tasks, click here

Set Value

Advanced logic provides the ability to write rules that set a specified value as a task 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 

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. 

Example:

In this example, if the first task (T1) within the first section (SA) of the Mission is answered with a value that is greater than 12, this rule will dynamically set 5 as the task response value to the fourth task (T4) within that same section. If the response to the first task (T1) is less than 12, the fourth task (T4) within Section A (SA) will not be given a response value of 5. 

For more on how to create set value rules, click here

Calculations

The advanced logic editor allows for the creation of numeric and text variables. The value of these variables is defined through calculations. With calculations users can:

  • perform math on numeric task responses to compute values for numeric variables
  • combine strings to establish values for text variables
  • create a set value rule that inserts a calculated task response value

Example:

In this example, SA.T1 asks for a total count of oranges and SA.T2 asks for a total count of apples. Advanced logic calculations allow for these two task responses to be aggregated, providing a total fruit count. 

First, create a numeric variable for this calculation. In this example, we named the variable total_fruit_count. This sample rule always sets the value for this variable as the sum of the task responses submitted for SA.T1 and SA.T2. 

For an in-depth overview of variables and calculations, click here

Piping Expressions

Piping allows mission builders to insert dynamic information into task titles, task descriptions, section titles, section descriptions, or mission instructions. Unlike other forms of advanced logic, piping expressions do not need to be written as rules in the logic text editor. Rather, information from any GoSpotCheck object can be piped into supported fields by typing a field name between curly brackets { }. 

Some basic piping examples include:

  • adding user names to mission instructions
  • integrating place information into task titles or descriptions
  • inserting property values into descriptions to provide additional context

Example:

This example of piping dynamically inserts a user’s first name into the mission instructions. 

 

For an in-depth overview of piping, click here. 

 

star
Have more questions? Submit a request