I am stuck in writing a rule for a particular problem statement.
I have an excel file having columns id, specialty,salary. Specialty can take values such as "oncology","urology" etc. I have to calculate total salary corresponding to each specialty.
There are two ways of doing this.
rule "Total salary of Oncology"
$m : Masterclass( $id : phyid , $p : p,spec=="Oncology")
not Masterclass( spec=="Oncology", phyid < $id)
$total : Number() from accumulate ( Masterclass( $salary : salary ,spec=="Oncology") ,
init( double total =0;),
result( new Double (total)))
System.out.println("Total target pay is : " + $total + " of specialty : "+ $m.getSpec());
And similarly for other specialties.
This rule works fine.
Write only a single rule which reads the value of specialty and then sums up the salaries corresponding to it.
I tried to implement this but didn't succeed.
Any help will be appreciated.