You can define a
Decision service variable by first specifying the name of the variable, then setting the variable
type. The variable value can be a simple data type such as a string, integer, or date. You can also
define a complex variable type using a business object that contains parameters.
Declaring the variables for a service enables the service to display
and manipulate the values that it receives from (input) and then pushes
back up (output) to the main business process.
Important: You
must initialize complex variable structures before running the Decision
service. In Business Automation Workflow,
all complex variables and all lists (arrays) must be initialized before
you use them in a process or service. If you do
not initialize a complex variable or list, you may receive runtime
errors or notice that the controls to which the variables are bound
do not behave as expected. For more information, refer to the related
topic "Initializing complex variables and lists."
Complex variables for hierarchical data
In
Business Automation Workflow, you
can create a custom variable type by using a base variable type or
by defining a new complex structure. You can create rules about complex
data that is nested, or hierarchical. Data that is referenced within
the text of a rule is not limited to simple data types such as string,
integer, or date. You can create complicated rules with nested variable
structure. For example, in the Decision service shown in the following
diagram, the variable
paymentIn has the variable
type
Payment, and contains other, nested variables.
For
more information about creating complex, hierarchical variable types,
see the related topic "Adding process variables to a process."
There
are several complex variable types that are not supported when authoring
rules in a Decision service. The unsupported variable types are:
- SQLResult
- XMLDocument
- XMLElement
- XMLNodeList
Collections (lists) of variables
You can
write rules against collections, or lists of variables, using Business
Action Language (BAL) rule constructs. You can use a variable to retrieve
a collection (list) of objects of a specific type. Use a list parameter
in a business object when then are numerous objects that your rule
must run against, instead of just a single object. For example, if
you are writing a rule about an invoice, and there are multiple line
items in the invoice, then the invoice is actually a collection of
line items. To write a rule against the number of line items (if there
are 10 or more line items, then process this invoice manually), add
a list parameter in a complex variable to your rule.
In the
complex variable type, or business object, shown in the following
diagram,
PastPayment is a list parameter, which
means that it contains multiple objects of the String, Decimal and
Date variable type. To identify a variable as a collection or list,
click to select the
Is List option under Parameter
Properties.
Predefined variable types
Many pre-defined
variable types are provided by the
Business Automation Workflow System
Data toolkit. These variables are defined as business objects. You
can open a business object in
Process Designer and
review the Documentation field to learn when and how to use each variable
type. For example, to open the
Record business
object included in the System Data toolkit, complete these steps:
- Open a process application in Process Designer.
- Click the indicator next to the Toolkits category to see a list
of toolkit dependencies for the current process application.
- Click the indicator next to the System Data toolkit to see its
contents.
- Click the Data category
- Double-click the Record business object
to open it. The Documentation field provides
information about the business object. The documentation informs you
that a Record is a group of ANY typed variables
and that you do not need to declare the number of ANY typed variables
that you want to go into the Record. So, the Record object is similar
to a Structure object, except you do not need to declare the type
or the number of variables it contains.
For additional information about using variable types in rules, refer to the related topic "Types
of variable definition" in the IBM® Operational Decision
Manager documentation.
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15