In order to make decision trees that can help solve real-world problems, sometimes you need the ability to do more than just choose a path based upon a finite set of choices. For these reasons, we’ve introduced Logic Nodes into Zingtree.
In addition, we’ve found that many of our customer’s integrations are passing data variables into Zingtree, and there are situations where they would like to act on the value of those variables. Logic Nodes make this easy.
If you’re an existing Zingtree author, Logic Nodes replace Scoring Nodes from previous versions. Any tree that is using Scoring Nodes is automatically migrated to this new system, without losing any functionality or you having to do any updating of your trees.
Here’s How Logic Nodes Work
When you edit or create a Logic Node, you’ll see something like this:
Logic Nodes test the value of your Zingtree variables with a series of rules and jump to a node when a condition is met. The rules are applied in order, so once a rule condition is met, the node assigned to the rule opens next. You can also assign a default node to jump to in case no rules apply.
In the example above, if the variable fruit equals banana, then Zingtree will open node #8, the “Banana” node. If fruit is watermelon, then the default “Something Else” node opens.
Variables can be numeric or text, and the comparisons work for either data type. You can bring variables into your trees in several ways:
- As Data Entry variables.
- By assigning score variable values to button clicks.
- By passing them into the Zingtree URL as Merge Variables.
- By introducing them as return values from Zingtree Webhooks.
Note: Your choice of variables is shown in a drop-down list. If Zingtree hasn’t encountered a variable yet in one of the above scenarios, then it won’t appear as an option.
When editing your Logic Nodes, you can edit your rules as follows:
- Reorder rules by dragging them up and down with this tool:
- Delete a rule by clicking on this:
- Select any existing variable from the Variables drop-down.
- Select an operator (=, ≠, <, >, ≤, ≥ ).
- Enter a value to perform the test upon.
You must also enter a default node to jump to if no conditions are met.
Advanced Logic Nodes with Expressions
The default Simple Logic Node is designed to be easy-to-use and foolproof, but if you need more advanced operations you can take advantage of the Advanced option in the Logic Node Editor. You can use parenthesis, as well as comparison and logical operators to build complex rules.
Just click the Advanced option, and you can enter expressions, like these shown below:
Examples: If you have variables named age and state…
Zingtree Logic Nodes give your decision trees a bonus option for adding extra intelligence to your processes and troubleshooters. Do you have a cool application for Logic Nodes you’d like to share with us? Reach out and tell us your story!
This article was originally published on May 8, 2017, but all the information is just as important and relevant.