Already familiar with logic nodes? You can find the rest of our resources here:

 

An Introduction to Logic Nodes

Zingtree’s logic nodes allow for an automatic branch from one node to another – outside of human interaction. Logic nodes determine where to go next by using variables collected during the course of the decision tree session, or when passed into the tree to start.

Logic nodes can also simplify the overall design of your tree by eliminating duplicate branches.

Here’s a step by step guide to how you can introduce logic nodes into your tree.

Step by Step: Building Simple Logic Nodes

Let’s start from the very beginning. If you’re a beginner, using the Zingtree Wizard is the best way to start building decision trees. In this example, we’re imagining that we run a bakery and that we need a decision tree that will suggest which type of cake the user should order depending on their preferences. This bakery offers different suggestions depending on how sweet the customer wants their cake, and how many people they need the cake to feed. The decision tree will provide the following recommendations:

Here’s the step-by-step guide to how we built this tree using logic nodes.

 

1. Starting with the Zingtree Wizard, we filled in the basic information about the tree.

2. We started this tree off with a simple question, how sweet do you like your cakes?

3. From this step, we made the next question, “How many people will be attending your event?” 

4. Then, we jumped back into the Overview Screen. From the Overview screen, you can add new content nodes by selecting Tools and Add New Node.

5. Here, we added our solution nodes, which in this tree are the different types of cake on offer.

We built a solution node like this one for each cake, leaving our overview looking a little like this:

6. From the Overview, we can go in to work on our nodes individually. Then it was time to add a Data Entry Field, so that users can input exactly how many guests they have attending. We selected the green editing option next to node #2, which asks “How many people will be attending your event?”. 

7. Here, we selected the tab “Data Entry Fields”, clicked on the “Add Data Entry Field” button, and added a variable name (“number_of_guests”) and label.

8. Then, we needed to add an action button to this node, so that when the user inputs the number of guests, it will be saved into the tree. Here the tree needs to move on to another node, so we have added a final “Almost there” node, where the user will click to reveal their cake recommendation. 

We quickly made that “Almost there” node…

 

…Leaving the “Action” blank for now, as it needed to be connected to the logic node that has not yet been built.

 

9. Once this was complete, we could then add that all-important logic node so that the data our user has just entered can help Zingtree produce an answer. We selected “Add Node” and then “Logic Node (Scoring)”.

10. Now that we have our logic node, we could then populate the variable and values so that the tree knows which cake to recommend. Remember how any customer that enters “Sweet” as their cake sweetness preference will be recommended a chocolate cake? And any customer that enters “Not Sweet”, a fruitcake? 

This means that we can make a simple logic node to direct any user that answers “Sweet” or “Not sweet” directly to the solution. They will therefore skip the question where they are asked to add how many guests will be attending.

11. So that the simple logic node will make this happen, we needed to select assign the “Variable” and “Value/Text”, shown here.

 

12. To do that, we returned to our first node that asks “How sweet do you like your cakes?”. Here, there are several steps to complete. Firstly, we needed to direct the “Sweet” and “Not so sweet” options to the simple logic node under the “Action” column. Then we needed to assign values to each response, we called them “sweet”, “normal” and “notsweet”, in the Score/Value column. Finally, we had to assign a name to the button click variable, which refers to the entire parameter. We called this “sweetness”. 

13. Then, we returned to the logic node to input the rule that will send “Sweet” and “Non-sweet” customers to the right cake. Here, we’ve created two rules, if sweetness = sweet, go to chocolate cake. Else, if sweetness = notsweet, go to fruit cake. These are selected from the drop-down menus. That’s our simple logic node complete!

Building Advanced Logic Nodes

However, if a user selects “Normal” for their preferred cake sweetness, then we need to know how many guests they are catering for in order to provide a recommendation. This is where an advanced logic node will come in handy.

Advanced logic nodes allow you to create more than one requirement in order to jump to a different node. In this example, the tree will examine both the sweetness and the number of guests at the same time in order to provide a recommendation.

14. Using the expressions shown in the screenshot below, we built our rules to send the user to the right cake recommendation. All of these expressions can be found here.

15. Then we have it, our tree is complete! Try it out below:

If you’d like to examine this tree a little closer, you can find it, along with all our other examples, over in the Zingtree gallery.

Ready to start building your first logic node? Jump into your Zingtree account and get started!