about processes and engines

Archive for the ‘rules’ Category

decision tables mashup

Yet another post related to Google.

They’ll be releasing Google spreadsheets soon…

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

Short post, small idea, Google providing us with a simple rule editor, online. Telegraphic style, again.
Will it be possible to integrate it within a gwebclient ?

Written by John Mettraux

June 6, 2006 at 8:40 pm

Posted in openwfe, rules, workflow

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 :

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

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 :

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

<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

Decision Tables

When I first devised this concept, I immediately thought “decision table”. It’s more a “rule set” thing though, or it’s “business rules” (but not RETE-style, just plain simple rules). “Decision Tables” is a good name then : it avoids confusion with “rule engines”.

The idea was first given me by Alexandre de Oliveira e Sousa’s work on OpenWFE and rule engines. The introduction to this master thesis comprised a full overview of the rules domain and such spreadsheet rules where the entry-level thing, simple and powerful, with wide applicability.

Let’s imagine you have some business logic that you need to insert within your OpenWFE process definition. Here’s a snippet :

            <equals field="customer_category" value="silver" />
            <set field-value="price" value="100" />

            <equals field="customer_category" value="gold" />
            <set field-value="price" value="80" />

            <equals field="customer_category" value="platinum" />
                <set field-value="price" value="60" />
                <set field-value="points" value="7" />
        <participant ref="invoicing" />

That adds up lots of, well, ‘code’. You might say that OpenWFE has agents and that it could be turned into :

        <participant ref="price-calculation-agent" />
        <participant ref="invoicing" />

OK, but you still have to implement the agent.

OpenWFE 1.7.1pre3 introduces a new participant, the ‘DecisionParticipant’. What about having a simple spreadsheet like this one ?

business rule

That you’d export into a CSV (comma separated values) file like that one :


to achieve the same result ?

(Don’t be afraid, Excel and OpenOffice will manage the export automatically for you).

Input fields have their names prefixed with “in:”, if matching values are found, the values of the “out:” cells of the row are set in the workitem.
As soon as one row matches, the execution stops (but you can tell the table to try to apply every rule (row)).

As of this 1.7.1pre3 [pre-]release, you have to add a participant definition to the file etc/engine/participant-map.xml and the table to a DecisionService within etc/engine/engine-configuration.xml (yes, it all happens in the engine, but a DecisionService could be configured within a Java APRE as well).

in etc/engine/participant-map.xml :


in etc/engine/engine-configuration.xml :


If a CSV file changed, the DecisionService will take care of reloading the newest version.

Further pre-releases will include a configuration scheme making it much easier to configure such tables / participants.

I’ll post further blog entries about these “Decision Tables”, there is more to know about them : they can be used as a powerful data transformation tool (hint : yes, they completely support OpenWFE’s dollar notation).

OpenWFE 1.7.1pre3 is available from the Download page.

Written by John Mettraux

May 30, 2006 at 11:48 am

Posted in bpm, bpms, openwfe, rules, workflow