First of all many thanks for helping me here. I completely agree with you
that I need to look into the basics. I will definitely start with drools
manual and examples.
coming back to the example which may not make a complete sense; I have a
deadline to meet and therefore, I dont have much time to look around. I
really appreciate your efforts for explaining my example. Basically, This is
what I am trying to achieve
rule 1 should check a condition and then perform the average. It also
retrieve a threshold from a class (just to show that). It then jump to rule
2 and thats why I used the agenda group.
rule 2 should only compare the average and the threshold. It should have
access to the average and the threshold. That is why i thought of inserting
them as facts in the first rule.
could you please look into the code below and give me further advise.
much appreciated
declare parameters
avg:double
end
rule "one"
$pers : person : Person( gender == 'M' ) // why $pers : person and not only
$pers
accumulate (
SensorReading( $temp : temperature ) over window:time( 10m ),
$avg : average( $temp );
then
insertLogical( /*$pers,*/ new AverageTempRecord( $avg ) ); // could you
please explain this. How exactly it should appear
drools.setFocus ("Two");
end
rule "two"
//should only compare avg>threshold
agenda-group "Two"
$p : Person() // I want threshold here
$a : AverageTemperatureRecord( /* pers == $p, */ $avg : avg )
then
end
--
View this message in context:
http://drools.46999.n3.nabble.com/function-in-drools-tp4020021p4020047.html
Sent from the Drools: User forum mailing list archive at
Nabble.com.