Hi All,
I wanted to throw to discussion a feature that might be good
in Drools. I am basically trying to model a formula evaluator in a decision
table. The idea being that a business user directly defines formulas(without
having to use Guided Editors in the BRMS or Eclipse, as business users love
Excel more than anything else..;)).
The thing I am trying to do is the following:
Condition Action
T:FormulaFact
formulaName
int salary=t.getSalary();
t.setBenefit($1);
Formula1
salary * 100
Formula2
salary * 1000
Everything runs great as Excel simply substitutes the entered
string into the function. The problem I face is when I write something like
this:
Formula3
min(salary,100)
The ”,” here is treated as the delimited
of a parameter. So the compiled DRL does not set the string correctly. It would
make a rule like
Rule FormulaTable_123
When
T: FormulaFact(formulaName=”Formula1”)
Then
int salary=t.getSalary();
t.setBenefit(min(salary); //Since the words after the
, become part of $2 which is not defined.
End
Is there any-way to declaratively change the Decision Table
Parser to not use , for delimiting between parameters and use some other
character.
I could always write the DT using my character, then compile
the DT into DRL and replace my character with ,(I am thinking of using “Colon”),
but would it be a good idea to have an Excel or a Property File that can
be read by the SpreadSheetCompiler to change the delimited character used by the
Parser.
Cheers,
Vikrant
MASTEK LTD. Mastek is in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |