Quantcast
Channel: Zingtree Technical Blog
Viewing all articles
Browse latest Browse all 405

New: Scoring and Branching Using Variables

$
0
0

updates-blog2

New with this recent release of Zingtree is the ability to branch to different nodes based upon any number of custom variables. The value of a variable can be modified by a button click, or by selections in check boxes, radio buttons, or list boxes in your node’s content. Each click or selection action increases the value of a custom variable by an amount you decide. Scoring Nodes let you determine which node to show next based upon the value of any variable.

For trees created prior to May 11, 2016: If you’re already using Scoring Nodes in your trees, they will still work as-is. Any pre-existing button clicks or list box selections add to a default variable named “score”. But for more complicated scoring and branching, having custom variable names simplifies the process and makes Zingtree even more powerful for knowledge management.

Using Custom Variables

The easiest way to get started with scoring nodes is to assign values to buttons clicks in each node. For any Question Node, using Overview, Edit Node:

  1. Enter a value for each button click.
  2. Once a value is entered, the Score Variable Name field appears.  You can use the default variable named score, or create your own.  There’s no limit to the number of variables you can have in a tree.

As your end-user clicks through the tree, the value of each button is added to the variable defined in that node.

Branching Using Scoring Nodes

When you’re ready to choose a course of action based upon a score, use a Scoring Node.  You can also enter the Score Variable Name into a Scoring Node. This will choose a new node to display based upon the value of the score variable.

Displaying Score Values in Your Content

Like any other variable in Zingtree, you can display its value by enclosing it in # characters. So to display the variable custom_score in the content of any node, enter it like this:

 #custom_score#

Using HTML Form Fields for Scoring and Branching

List boxes, check boxes and radio buttons can also add to a custom scoring variable.  Each element in a form field can have the following attributes:

  • score: This is the score value if this item is selected.
  • score_var: This is the name of the custom variable that gets added to when the item is selected.  If this is not present, the default action is to add to a variable named “score”.

Currently this requires you to edit the HTML for your form fields.  Below are some examples to add to a variable named custom_score.

List box example:

<select name="var1" class="form-control zt-data">      
<option value="1" score="1" score_var="custom_score">Score 1</option>     
<option value="2" score="2" score_var="custom_score">Score 2</option>     
<option value="3" score="3" score_var="custom_score">Score 3</option>    
</select>

Radio Button Example:

<input class="zt-data" type="radio" name="radio" value="1" score="1" score_var="custom_score">
<input class="zt-data" type="radio" name="radio" value="1" score="1" score_var="custom_score">

Check box example:

<input type="checkbox" value="1" class="zt-data" name="check_name" score="1" score_var="custom_score">

Important: Use different names for the score_var and name attributes in your HTML form fields.

Importing Scoring Variables from Other Systems

You can retrieve scoring values from other system using Webhooks.  The webhook needs to return an integer value in a variable. This can be used by a scoring node to branch.

Example: This script used in our demo tree adds 1000 to the value of the score parameter, and returns it in a variable named score1000.
http://zingtree.com/test/webhook-score.php?score=123

Demo Trees

Try these trees from our Gallery to see how scoring works.

Scoring Demo
Narcissist Test

Your Turn!

You now have the ability to build some really sophisticated knowledge sharing tools with this new Zingtree capability. So make something awesome, and let us know how it goes!


Viewing all articles
Browse latest Browse all 405

Trending Articles