|
  
Building a Decision Tree Script
Open DecisionScript to the default screen. In the Tree Window,
double-click on the yellow box next to the root node.
Automatically, the formula for the root node appears in the
Definition Window and you are prompted for the root nodes text in the
Form Window. Each time you double-click on the yellow box, you
create a new branch and the formula is modified appropriately in
the Definition Window. Double-click twice on the yellow box so
that two branches are added.
With the root node highlighted, click your cursor in the Form
Window. Delete the words, »Enter Root
question here, and replace it with:
Welcome to Jupiter Cellular.
By answering the following questions, we can determine which of
our
wireless service plans best meets your cellular phone needs.
Do you plan to use your cellular phone for personal or business
calls?
Do not hit the Enter key when you have finished typing unless
you want to add a blank line after the question. Instead, click
in the Tree Window for the text to be accepted.
In the Tree Window, highlight the first branch labeled Ins1.
Delete the text, »Enter Root option 1
text here, and replace it with the word Personal. Do the same thing with the
second branch, Ins2, except replace its text with the word
Business.
Note: You can edit directly in the Tree
Window by clicking twice (not double-clicking) on the text you
want to edit. You can also edit the node text by clicking on the Edit
Comments toolbar button .
At this point, if you were to run the script it would look
like this:
When executing the definition for Root, DecisionScript
retrieved the text for the question presented to the user from
the Form Window attached to Root. However, it retrieved
the names for the options presented below the question text from
the nodes Ins1 and Ins2, which are children of Root.
At this point, if the user selected Personal and then
chose Next, DecisionScript would execute Ins1.
Similarly, if the user selected Business and then choose Next,
DecisionScript would execute Ins2. The basic structure
used to create the node Root is repeated for all
subsequent nodes in the decision tree.
If the Web site visitor selects Personal, the next
question to ask is:
Approximately how many minutes of
calls do you expect to make in a month?
To enter this question, highlight the Ins1 node in the
Tree Window and type the question text in the Form Window. It is
important to realize that questions you want to ask your Web site
visitor are typed in the Form Window; the possible answers are
typed directly into the top portion of the child branch nodes.
If you look at the definition for Ins1, you will note
that it is:
Ins1:=say
If you were to run the script now and the user chose Personal,
DecisionScript would simply display the text attached to Ins1
and then quit. What you really want is for the script to ask
another question. To make this happen, simply double-click twice
on the yellow box following the node Ins1. DecisionScript
will change the definition for Ins1 and two new branches
will appear.
In Ins3, type the words, 0 to
30 minutes. In Ins4, type More
than 30 minutes.
If at anytime during the construction phase you want to test
your script, just click the Run Local toolbar button .
Remember that your cursor must be placed in the Tree Window for
the Run Local option to be active. To test the script
using an Internet browser, click the Run in Browser tool .
Node names, Ins1, Ins2, etc., can be replaced
with other text. You change a node name by editing it directly in
the Tree Window or in the Definition Window. When you rename a
node, DecisionScript automatically performs a global substitution
so that your script will continue to behave properly.
Returning to the example, if the Web site visitor chooses 0
to 30 minutes, the next question to ask is if the visitor
also needs call forwarding service. To enter this question in the
script, highlight the 0 to 30 minutes node in the Tree
Window and type the following question in the Form Window:
Do you need Call Forwarding?
Once again, there are two possible answers to this question.
Double-click twice on Ins3 to create two branches and type
the words Yes and No directly into the top half of the
two new nodes.
If the customer says he needs call forwarding, then the script
should tell him about Jupiter Cellular's Deluxe Plan. You could
do this by selecting node Ins5 and then typing details
about the deluxe plan in the Form Window. However, since there
are several places in this script where you will present this
same information, you should define Ins5 as:
Ins5:=Deluxe Plan
Then define Deluxe Plan as shown below:
The Deluxe Plan node also asks the customer if he wants
to sign up now for the service. If the customer responds Yes,
then the script could use the redirect
function to send the user to an order-taking script on the Web
site. Redirects can be entered by pointing to Input/Output
Function in the Insert menu and clicking Redirect
to a New URL.
In this example, we have shown you how to build only one
branch in the tree. However, for the script to be complete, all
the remaining branches must be completed as well.
Though Jupiter Cellular only has five wireless service plans,
the script--when completely built--is somewhat complex. This can
be better understood by looking at the script in the horizontal
tree format. To do this, point to Sheet in the Format
menu, click Properties , and then choose one
of the other possible view options. If you prefer, you can build
your script using a horizontal view.
For numerous products and services, each with a variety of
characteristics, a Decision Tree script may become cumbersome to
build and follow. In those cases, a Rule-Based script is more
appropriate.
|