Page 321 -
P. 321
11 The Worklet Service 317
For example: 12 OrderFulfillment Payment Selection ProcessPayment.xws (xws
for XML Worklet Selection). The identifiers in the filename refer to the parent speci-
fication instance, not the worklet case instance. Also, the WorkItemID identifier part
will not appear for case-level rule types. So, to add a new rule after an inappropriate
Worklet choice, the particular selected log file for the case that was the catalyst for
the rule addition must be located and loaded into the rules editor’s Add Rule form.
Before a rule can be added, the appropriate rule set must first be loaded into the edi-
tor. Note that the selected file chosen must be for an instance of the specification that
matches the specification rule set loaded in the editor (in other words, you cannot
attempt to add a new rule to a rule set that bears no relation to the xws file opened
here). If the specifications do not match, an error message will display.
The Rules Editor takes care of where the new rule node is to be attached in the
rule tree, and whether it is to be added as a true child or false child node, using the
algorithm described in Chap. 4. The parent node of the new rule node is the node
that was returned as the “last searched node” included in the result of the original
rule tree evaluation.
The Add Rule form has two panels: the Cornerstone Case panel contains the case
data that existed for the creation of the original rule that resulted in the selection.
The Current Case panel contains the case data for the current case, that is, the case
that is the catalyst for the addition of the new rule. The New Rule Node panel is
where the details of the new rule may be added.
As the case data for the original rule and the case data for the new rule are both
displayed, to define a condition for the new rule it is only necessary to determine
what it is about the current case that makes it necessary for the new rule to be added.
That is, it is only where the values for the corresponding case data attributes differ
that distinguishes one case from the other, and further, only a subset of that differ-
ing data is relevant to the reason why the original selection was inappropriate. For
example, while there may be many data items that differ between the two case data
sets, there are only two differing data items of relevance here: underpaid amount
and client rating – those are the only data items that, in this case, make the selection
of the Issue Debit Adjustment worklet inappropriate.
Clicking on those lines in the Current Case panel copies them to the Condition
field in the New Rule Node panel. Thus, a condition for the new rule has been easily
created, based on the differing data attributes and values that has caused the original
worklet selection to be invalid for this case.
The Condition input of the Add Rule form allows direct editing of the inserted
condition. Conditions may be expressed as strings of operands and operators of
any complexity, and subexpressions may be parenthesized, or alternately XQuery
expressions may be used. Table 11.1 shows the supported operators and their order
of precedence.
All conditions must finally evaluate to a Boolean value.
After defining a condition for the new rule, the name of the appropriate worklet
or exlet to be executed when this condition evaluates to true must be entered in
the Conclusion field of the New Rule Node panel. If the new rule is to be added