processi

about processes and engines

Decision Tables examples

update : I implemented those decision tables as a ruby gem see this blog post.


Decision tables allow users to enumerate rules as rows in a spreadsheet that OpenWFE will interpret (well, the CSV export at least). It’s a straightforward way to describe complex data conditions and manipulations.

Decision tables, being just participants, may be leveraged by many processes. Like any other participant, they take as input a workitem that they manipulate, setting fields according to the values contained in other fields.

I’ll list here a few decision tables and explain how they could be used.

mapping users to departmentsMapping users to their respective departments
When passing through this table, a workitem whose payload is

{ "employee" => "Charly" }

will end up with

{ "employee" => "Charly", "department" => "RD" }

The system added the field “department” and gave it the appropriate value.

who's the next participantWho’s the next participant ?
This example contains two input fields “launcher” (the launcher of the flow) and “department” (his department). There is one output named “next-participant”.

It might be used from a flow like :

<sequence>
    <participant ref="decide-next" />
    <participant ref="${field:next-participant}" />
</sequence>

When a cell is empty, the field is not evaluated (no match against “”). As rules are evaluated one by one from top to bottom, ‘exceptions’ may be placed on the top of the list. Here, Alfred’s next participant will be Bob, even if Alfred is in the HR or the RD department.

“${field:launcher}” will put the value of the field “launcher” as the value of the field “next-participant”, and this rule applies only for people in the Finance department (and of course, it doesn’t apply for Alfred and Bob).

dt3Subprocesses and regular expressions
Regular expressions are allowed. Thus here, all product whose name starts with “Xana” will have their workitem field “evaluation-process” set to “area51-process”.

Those are regular expressions à la Java.

This ‘evaluation-process’ example might hide behind a participant named “choose-process” (define that in etc/engine/participant-map.xml) and be used to prepare the application of a ‘subprocess’ expression :

<sequence>
    ...
    <participant ref="choose-process" />
    <subprocess ref="${f:evaluation-process}" />
    ...
</sequence>

<process-definition name="area51-process">
...

The full range of the ‘dollar notation‘ is available within the decision tables, that’s a reason for which I put them in the engine component : they may thus see all the variables and call functions (of course, they see workitem fields).

But the DecisionService (the code that the DecisionParticipant uses), is not engine-bound : it could be used within other OpenWFE components, and, of course, within other java applications that are not OpenWFE related. It’s a very powerful tool.

Written by John Mettraux

May 31, 2006 at 3:45 pm

Posted in openwfe, rules, workflow

2 Responses

Subscribe to comments with RSS.

  1. […] What a nice way to edit decision tables online. Yes, you can upload from and save to CSV. […]

  2. […] already blogged about decision tables. Now the implementation is available in Ruby as […]


Comments are closed.

%d bloggers like this: