Workflow Soluiton

 View Only

Workflow Tutorial: Decision Tree Demo 

Apr 02, 2008 11:49 AM

If only all decisions were this easy. A decision tree! Can I get one at the garden store? The purpose of this tutorial is to create a basic project using a decision tree which takes in two numbers and compare them.

Prerequisites: None

Objective: To create a project which utilizes the a basic decision tree to compare two numbers.

Estimated time to complete: 15-20 minutes

Step 1: Create a New Project

To begin, create a new Decision Only project. The Decision Only project can be selected from the main page when you first run Workflow Designer.

Step 2: Setting Up Your Project

You must begin by setting up the input and output data for your project. This will dictate what data the project takes in and how it returns its final product (the result of the comparison of the two input numbers).

Begin by selecting the Input Data link in the Project Info box on the left-hand side of your screen.

Click the Add button twice to create two input variables:

Call the first variable "A" and the second "B". Set both variable types to "Number (decimal)".

Next, select the Output Data link in the Project Info box. Click the Add button once to create one output variable.

Call this variable "OutputText" and set its type to "Text." Return to the primary model page by selecting the Model: Primary tab at the top of the screen.

Click on the Import Components link under the toolbox of your project's main model screen. In the Add Library to Project window, select DecisionTable.xdll and click the Add button. Click the OK button to perform the import:

Drag-and-drop a DecisionTreeComponent from your toolbox to your model, and connect it to the Start Component and EndComponent as shown below.

If you are having trouble finding the DecisionTreeComponent, you may search for it by selecting the Search tab in the toolbox and entering "tree" in the Search For field:

Step 3: Edit the DecisionTreeComponent

Right-click on your DecisionTreeComponent and select Edit Component. In the Edit Component window, click the ... button to the right of the Output Data field.

In the Edit Parameters window, click the Add button. Set your new entry's name to "RetValue" and set its type to "Text":

Click the Done button. Then, click the OK button in the Edit Component window to accept changes.

Double-click on the DecisionTreeComponent. This will bring up the Decision Tree Editor. The first step is optional and is pre-set. Therefore, we can simply click the Next>> button to move on to the Decision Tree step:

Right-click in the Decision Tree list and select Add Rule. In the Component Browser window, select CompareNumbersRule and click the OK button:

Select your newly-created CompareNumbersRule in the Decision Tree box. Select the the ... button to the right of the Value1 field:

In the Specify Variable Names or Constant Value window, select the Add button under the Variable Data (0) tab:

Select the variable "A" in the window and click the OK button. Click the OK button in the Specify Variable Names or Constant Value window to accept changes.

Click the ... button to the right of the Value2 field. Repeat the above process for the Value2 field. However, instead of selecting the variable "A", select the variable "B".

Return to the Decision Tree Editor window, and select the less than entry in the Decision Tree window:

Enter "Largest is B" in the Ret Value field.

Select greater than in the Decision Tree list. Enter "Largest is A" in the Ret Value field:

Click the Finish button to accept changes.

Step 4: Edit the End Component

Once you have returned to the main project model, right-click on the EndComponent and select Edit Component. In the Edit Component window, click the ... button to the right of the Mapping field.

In the Edit Data Mapping window, select the Value from Data field and click the ... button to the right of the Value from Data field:

In the Select Variable Namewindow, select the "RetValue" variable, and click the OK button. Click the OK button in both the Edit Data Mapping and Edit Component windows to accept changes.

Step 5: Run and Test Your Project

Run your project by clicking on the Debug button on your toolbar. This button looks like a bug with a green arrow over it. Your project will ask for initial input:

Enter the values "78" and "22" in the A and B fields respectively. Click the OK button to continue. Your project will begin executing. When completed, it will display the results of the execution:

In this example, "A" is larger than "B". Therefore, the output of the project is "Largest is A."

Finished!

Statistics
0 Favorited
1 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

Apr 02, 2008 03:16 PM

while its been nice to see all of these seperate workflow things and how to create them, it would be nice to see more workflows that put together a lot of the components that we could then break down and further understand how everything flows together.
i already have the symantec hardware request form, but i have heard there were more workflow packs coming out, anyone know anything about those/
thanks for the information you ahve provided, would be great to see more complete workflows

Related Entries and Links

No Related Resource entered.