Tutorial - Conditional Routing

1 - Tutorial Overview

With Asternic Scripter, you can deliver a unique and personalized script, survey or questionnaire, making the process feel more like a conversation.

Some of the dynamic feature we will cover in this tutorial are:

  • Conditional Routing
  • Variable substitution


2 - Data Collection

In our first tutorial for a basic script, we covered how to branch a script to specific nodes based on Answers.

This is not the only way to do routing, we can also use actual form answers, or the score assigned to them, to use in logical conditions to route the script to a specific node.

We will start our script by gathering some information from our customer using some data entry fields. Based on the answers provided in the form, we will  then branch to a specific part of the script.

First of all, lets create a new script with the name "Routing Demo"

In the script grid view, click on the Edit Nodes buttons on our newly created script and then click the Add button to create our first node.



The first node will be of type Question as we will need to click on a button to continue with the process, let's set the title Data Collection to it, as shown:


To continue with our script we must present the user with a continue button, that goes added as an answer in the Answers section. We will fill up that right now: click the Add Answer button, set its text as Continue 

In the Link box select none so we get the quickly create a new node window pop up. This new node will be of type Logic Jump. We will use the  title "Logic Jump based on age", as shown:

Click Add Node when done. The editing page will look like this once the answer is created. Note that the Continue answer will link to the 2nd node that will jump to a specific destination based on conditions we will define.


Do not click Save yet, we are not finished! We are going to add some data entry fields. Click on the Data Entry tab as shown:


We are going to ask for name and age, so click the Add Field button, we will first ask for the customer name:

It's a single line of text. With the name variable and Name label. We mark it as required also. When you are done, click the Add Field button to save it.

Then create the second data entry field, click Add Field again:


As you see we select the type Radio Buttons to give the user a multiple choice list where only one selection is valid. We marked it to be required and used the variable name 'age_range' while the label is the actual question: What is your age?

Then we entered every option available in the list options text area, one per line.  We also selected the "use score" checkbox. This allow us to configure a specific variable name to hold the numeric score and in the contiguos text area labeled Scores we can the numeric score for each of the options configured.


IMPORTANT

The score variable name must differ from the field variable name. Scripter also has a generic score variable already created for you, that you can use directly from answers that might have assigned a score to them. Also, score variables will always be numerical, as we will use arithmetic sum whenever something is set for that variable in a node. You can have a node that will set the score, and a subsequent node that will add to the same score variable.


We chose to use numeric scores as it is sometimes simpler to use numerical conditions than textual based ones, although you could skip using scores and just use the actual option selected and the form field variable name instead for your logical conditions.

When done, click Add Field to save it. Our node will look like this:

We are done with our first node. Click Save to finish.






3 - Populating all destination nodes

This is how our script looks like for now, the Data Collection node and the quickly created Logic Jump as our only answer on the first node:


For simplicity, before editing the logic jump node we will first create the destinations where we want to land after our logic conditions are met.

Our date range has 6 options, so we will create 6 new nodes as landing nodes for each. Go ahead an click the Add button to create a new node: