bw2:decision_tool

This is an old revision of the document!


Introduction (Decisions)

This page describes the use of the Bizweaver Decision tool.

Decision Tool

The Bizweaver Decision tool provides the ability to do “branching” within a workflow based on values found in previous workflow steps. The test condition can be very simple, based on a single value, or more complicated using AND/OR conditions for a single test.

Basic Configuration Steps

A Decision step can be added to a workflow at any time. Following is an example of a set of decisions that might be constructed.

The initial workflow is very simple. A SQLCommand query step retrieves a list of Business Partners from the SAP Business One database. The decision(s) are within a loop since we want to evaluate each record individually.

Three values are included in the query: Partner Code and Partner Type. Our decision will be based on Partner Type, one of three values: C, S, or L.

We will begin by adding a single decision. If the Partner Type = ‘C’, we will take one path. Otherwise, we will take a different path.

For simplicity in this illustration, the only action taken for the next step will be to execute another SQLCommand query to obtain the Business Partner’s name from the database.

It should be noted here that adding the step that will be executed based on the decision makes the setup process somewhat easier. The actual step depends on checking for a “True” or “False” decision. This approach is used here, but it is not mandatory.

In this first example, we will be branching to the SLQCommand step if the Card Type value = ‘C’.

  1. Drag the tool to be executed for the “true” decision step into the design area and configure it as needed.
  2. Drag a Decision tool into the design area.
    1. At this point, you can either enter the evaluation rule or close the Decision.
      1. In either case, you will need to link the Decision to its preceding step.
  3. If the application has not already done so, connect the Decision to the appropriate output step.
  4. Open the Decision tool and configure the evaluation expression that will lead to the output step.

    Be sure to pick the appropriate data Type for the value being evaluated.

    The evaluation expression can be viewed in the “Branching Details” window of the Decision. This will also show you where the branch will go if the evaluation is true.
  5. Drag a “Merge” tool into the design area.
  6. Connect the Decision output step to the Merge tool.
  7. Connect the Merge tool to the subsequent step in the workflow.

Using the “Else” Decision Rule

It is unnecessary to add an explicit ELSE evaluation in the decision for situations where you have a single evaluation, and that evaluation is false. The application will proceed to the next step that is not associated with the true evaluation. In the example above, a false evaluation will go directly to the “Merge1” step.

However, if you want a false evaluation to go to a specific step, an ELSE evaluation must be used. In this next example, we want the flow to move to the “SQLCommand_getOtherName” step. Therefore, we have an explicit ELSE step to point the workflow in that direction.

“No Match” Situations

You may also have situations where no action should be taken if none of the evaluation conditions are met. Nothing needs to be done in this case. If none of the evaluation conditions are met, and an ELSE path is not found, the workflow goes to the End Decision step that ends the decision and continues processing. This is what is happening in the initial example discussed earlier.

Multiple Evaluation Criteria

The previous examples illustrate a single evaluation criterion. In some cases, however, the evaluation may need to be more complex. In the following (simple) example, we read a list of all the SAP Business One Business Partners. We then want to take any action if 1) a customer (CardType = ‘C’) and 2) their current A/R balance is greater or equal to 50,000. The evaluation will look like this:

  1. AND and OR relationships are supported.
  2. Relationships can be defined using a combination of AND and OR.
  3. When using multiple AND relationships, all conditions must be met for the result to be true.
  4. When using a combination of AND and OR relations, the OR relationships are considered together.
  5. It may be necessary to try different combinations of AND and OR to obtain the desired result.

Decisions Variables

Name Description
StepMessage During a failure the reason for failure will be populated here
StepStatus True or False
bw2/decision_tool.1659467853.txt.gz · Last modified: 2022/08/02 15:17 by akoehler