Example: Workflow condition builder
Some types of tasks use a condition to decide what they should do. A condition is a comparison between values. A condition is either true or false. The properties forms for these tasks share a common organization to create and edit conditions.
The Condition Builder's purpose is to build a formula in its bottom panel that is either true or false. You build the formula using the Edit and Insert menus at the top of the condition builder, along with the Tasks, Basic Ops and System Function panels.
The Tasks panel allows you to insert task attributes and fields of records into the condition.
The Basic Ops panel allows you to insert operators into the condition.
The System Function panel allows you to insert system defined and user defined functions into a condition.
The following example shows the use of these panels and menus. After this example are more detailed explanations.
Create Record::Success=="SUCCESS" &&
Start::Employee::Detail::DateHire<=CurrentTime()
In the beginning there is no formula. There is just a small gray rectangle in the bottom panel. The Condition Builder puts a gray rectangle before each part of the formula.
When you add a part to the formula, it gets added to the right of the currently selected gray rectangle. You can select a gray rectangle by clicking it. You can tell that a gray rectangle has been selected because it will have a blinking cursor inside of it.
The gray rectangle in an empty Condition Builder is already selected. The first thing we will add to the condition is a reference to the Create Record task's success attribute. To do this, we use the Tasks panel.
We begin by clicking the folder icon next to the name of the Create Record task. Clicking the icon causes the attributes and business objects associated with the task to be displayed under the task. The folder icon changes to an open-folder icon.
When we add the reference to the Success attribute, the Condition builder adds another gray rectangle after what we added. The new rectangle after what we added is automatically selected, so the next thing we add will be to the right of that.
The next thing to add to the condition is ==. The == will compare the value of the Success attribute to whatever we put to the right of the ==. The comparison will be true if the two have the same value or false if they do not.
The next thing to do is add the text "SUCCESS" so that the condition can be true if the value of the Create Record task's Success attribute is equal to "SUCCESS". To put a text or number value in a condition, we use the Insert menu at the top of the condition builder.
Clicking the Number menu item allows you to add a Number value to a condition. Clicking the String menu item allows you to add a text value to a condition. Clicking either of these menu items creates a box in the Condition where you can enter a number or text value as appropriate.
The next thing to add to the condition is the operator &&. The && operator is a logical && operator. The and operator is true if the conditions on both sides of the && operator are true.
After we added "SUCCESS" to the condition, the part of the condition that was selected was the box that contains "SUCCESS". The Condition Builder will not allow us to do anything to the condition unless one of the gray boxes is selected. Before we can add the && operator to the end of the condition, we must select the gray box at the end of the condition by clicking it. We then add the && operator by clicking && in the Basic Ops panel.
The next thing we add to the condition is a reference to the DateHire field in the Employee record that was used to launch the workflow. Since the record that was used to launch the workflow is associated with the Start task, click the Start task's folder icon to see the list of things under the Start task. This list includes the Employee record that was used to launch the workflow.
The list that appears in the Tasks panel under the name of a kind of record is a list of section names. An icon appears next to each section name. If what appears next to a section's name is a document icon, the section is a type of section that the Condition Builder cannot use to access fields.
At the time of this writing, the Condition Builder is unable to access fields in multiple-record smart sections. Most of the sections in the figure that have a document icon are multiple-record smart sections.
If what appears next to a section's name is a folder icon or an open-folder icon, then the Condition Builder is able to access the section's fields. At the time of this writing, there are only two kinds of sections that have a folder icon or an open-folder icon next to their name. Single-record smart sections have one of these icons next to their name.
The other kind of section that has a folder icon or an open-folder icon next to its name really is not a section. The Condition Builder pretends that a business object's fields that are not in a smart section are in a section named General. This artificial General section has a folder icon or an open-folder icon next to its name.
The next thing to add to the condition is a <= that will be used to determine if the value of the DateHire field is before or equal to the current time. We add it by clicking the <= in the Basic Ops panel.
The system functions that you can click in the System Function panel are the same system functions that are used for extended formulas. For more information, see Application Building for the IBM TRIRIGA Application Platform: Calculations.
You can access user defined functions by clicking the button labeled User Defined Function. These are the same user defined functions that are used for extended formulas. For more information, see Application Building for the IBM TRIRIGA Application Platform: Calculations.
2 + 3 * 4 == 4 * (3 + 2)
For Integration, 0 is Not Selected and 1 is Selected. For more information on the Integration property, see "Start task".