Friday, July 30, 2010

JBoss BRMS Decision Table Double Quotes Errors (Open Office)

When using JBoss BRMS to manage your rules you might consider using Decision Tables. It is quite common to generate your decision tables in XLS files (spreadsheets) and this will be default on most Linux machines result in an Open Office spreadsheet. When you put a CONDITION field with for example:

setValue("$param");

You would expect the quotes to be converted properly, but Open Office morphs these and you will see the following when trying to create add you decision table to your KnowledgeBuilder:

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration();
config.setInputType(DecisionTableInputType.XLS);
kbuilder.add(ResourceFactory.newClassPathResource("MyDemoDecisionTable.xls"), ResourceType.DTABLE, config);

// Exception you can expect is like this:
//
[8,29]: [ERR 101] Line 18:11 no viable alternative at input ''

To avoid this just cut&paste your quotes from the command line for example I type this in a console and then just select the line to paste into my Open Office field:
$ "$param"

Hope it saves you some headaches and time...