Excel decision tables are widely used to represent rule logic in a compact format.

This format is particularly popular as non-technical business users can read, edit and maintain the conditional logic in Excel spreadsheets.


This example shows how to use an Excel decision table rules inside a process.

The ‘Rule Task’ components can use the rules defined in a drl file, Excel decision table or the rules defined in BRMS (Guvnor).

An example to use the rules defined in drl file is shown in http://community.jboss.org/people/bpmn2user/blog/2011/03/07/jbpm5--ruletask-example.

This example shows how to run the same example using Excel decision table.


Please refer to Drools documentation (http://downloads.jboss.com/drools/docs/ to know about authoring Drools decision tables.


Here are rules represented in Excel decision table.

ScreenHunter_12 Mar. 07 18.25.gif


There are three rules in the following decision table. For example, Rule1 (Row 11) means that if the 'userlocation' is set to ‘NewYorkUser’ and the initial count is less 4, then the ‘loopcondition’ is set to 6.


Following is the main process flow diagram. This example has a loop condition which is determined using the rules shown in the above decision table in the RuleTask 'LoopConditionRules'.



ScreenHunter_03 Mar. 07 14.14.gif

'LoopConditionRules' is a 'Rule Task' component and it needs to have a valid RuleFlowGroup name (e.g.,  EvalLoopcondistion as shown below) and it should match with the 'RULEFLOW-GROUP' name (Column C) of the decision table.


ScreenHunter_04 Mar. 07 14.14.gif

Excel decision table needs to be added to the Knowledgebase as shown below.


private static KnowledgeBase readKnowledgeBase() throws Exception {


                .setProcessBuilderFactoryService(new ProcessBuilderFactoryServiceImpl());


                .setProcessMarshallerFactoryService(new ProcessMarshallerFactoryServiceImpl());


                .setProcessRuntimeFactoryService(new ProcessRuntimeFactoryServiceImpl());


                .setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory





         * Add Excel decision table file



        DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration();


        kbuilder.add(ResourceFactory.newClassPathResource("LoopConditionRules.xls"), ResourceType.DTABLE, config);


        return kbuilder.newKnowledgeBase();



How to deploy?

This example has a bpmn file (processRuleslooptest777.bpmn), model file (HelloProcessModel.java), rules file (LoopConditionRules.xls) and a test file (HelloProcessTest.java). It might be easy to start with a HelloProcess project (http://community.jboss.org/people/bpmn2user/blog/2011/02/27/helloprocess-example-using-jbpm5-eclipse-plug-in) and import these files.

ScreenHunter_13 Mar. 07 19.30.gif


Following results can be seen after successfully running the example.

ScreenHunter_07 Mar. 07 14.18.gif