I try to add a formula for calculation salary according to salary?
if(age>25)
Salary = Salary + cofactor *Salary
My RULE :
Source : The Kie Workbench created below code ;
package com.myteam.rbffiyatlama2;
//from row number: 1
rule "Row 1 GDT1" extends "GR1"
dialect "mvel"
when
f1 : Employee( age >= 25 )
then
modify( f1 ) {
setSalary( 0.0 )
}
end
But I can not set salary by using : Salary = Salary + cofactor *Salary
My Desired rule must be below by using guided rule table:
package com.myteam.rbffiyatlama2;
//from row number: 1
rule "Row 1 GDT1" extends "GR1"
dialect "mvel"
when
f1 : Employee( age >= 25 )
then
modify( f1 ) {
setSalary( f1.Salary + f1.cofactor *f1.Salary )
}
end
How can I add Formula of (setSalary( f1.Salary + f1.cofactor *f1.Salary )) in Guided Decision table ?
I faced such a case and did the following: Bind a condition column and add action brl fragment column - modify value of filed - field value formula and add my formula.
And the end I have this source of gui table
package com.myspace.project;
//from row number: 1
rule "Row 1 gui"
dialect "mvel"
when
$c : Customer( $b : balance, $d : discount)
then
modify( $c ) {
setIncome( $b*$d*10 )
}
end