Drool Guvnor-Accessing Rules which are expired to do back dated calculations
by Minal Sarmokadam
Hi,
I am evaluating Drool Gunvor for to implement Rules for some finance related functionality.
I need help from users to implement following scenario is Drools-Guvnor
I have created simple Rule to Calculate House Rent Allowance i.e. HRA as
HRA = 0.12 * Basic salary .(Basic will come as Input Parameter).
This rule is valid from e.g. 01-Jan-2005 to 31-July-2010 as HRA rule is changed from 1st Aug 2010
I will have to create new Rule for HRA Rule with new formula as
HRA = 0.15 * Basic salary .(Basic will come as Input Parameter).
This rule is valid from 01-Aug-2010 to 01-Aug-2999
>From 1st Aug HRA should be calculated using New Rule. But at the same time if any Arrears to be calculated(back dated calculation) depending on the date old HRA rule should be applicable.I would need this to calculate Arrears i.e. doing backdated calculations
Can I achieve this in Gunor Drool. I could achieve first half by specifying date-expires . But I am not able to achieve second half i.e. referring old rule depending on the date. I would appreciate help to solve this problem .
Thanks in advance.
Regards
Minal S
________________________________
This Email may contain confidential or privileged information for the intended recipient (s) If you are not the intended recipient, please do not use or disseminate the information, notify the sender and delete it from your system.
______________________________________________________________________
15 years, 10 months
How to write a simple DSL which can be used in setting / comparing the value prsent in hashmap
by bbarani
Hi,
I have created a very simple DSL file as below. It just reads the data from
hashmap and sets the decision based on the key value present in the hashmap
passed to Guvnor.
[consequence][]Decision for DynamicValue is set as
Denied=dec.setDecision("Denied");
[condition][]Decision Object=dec:Decisions()
[condition][]Map Object=mp:DynMap()
[condition][]Evaluate Dynamic value of
rules=eval(mp.getMap().get("AssetID").toString().trim()=="8-AIT-3243")
I now want to create a rule such that I am able to enter both LHS and RHS
dynamically and the rule will fetch the data based on the key value..
something like below
When dynamicAttribute("Assetid")="23" then System.out.println(Sucess); else
dynamicAttribute("repoid")="23" then System.out.println(Sucess);
end
My DSL works fine now just tht I want to make it more user frindly and want
the dynamic attribute to be listed in the dropdown for users to select it ..
Thanks,
BB
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/How-to-write-a-simple...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
.drl Rules without Java
by Baig, Kaleem
---------
There is a list of objects.
Each object has a property "score".
We need to select three objects with the highest scores.
How to create this rule in Guvnor (This would be easy in Java, but we want no code in the rules)?
Thank you!!!
15 years, 10 months
getFactHandle() returns null
by retoy
Has anybody ever had the problem that getFactHandle(object) returned null,
although the FactHandle is there when you iterate over the handles returned
by getFactHandles()?
Can anybody explain to me what the problem might be?
By the way: The object reference (getObject()) in the FactHandle I get
through getFactHandles() is identical to the one passed to getFactHandle(),
and the assertion mode doesn't matter...
Thanks!
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/getFactHandle-returns...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
are for loops possible in drools
by ceemh3
does anybody know if there is a way to do for loops in drools ?.
I am trying to loop through a list of string to see if one of the strings
matches a pattern e.g.
def listOfStrings = ['a','a.b','a.b.c']
for(String s:listOfStrings){
if(s matches "^a.b.*$"){
return true
}
}
I have written the following rule based on what documentation I could find,
but I dont think the syntax is correct
rule "Matcher"
when
TestClass : TestClass(($s matches "^a.b.*$") from listOfStrings,
count($s))
then
TestClass.setResponse( "Condition is True !!" );
end
I am finding it hard to find good documentation on the drl language
I would appreciate any help that anybody can give me
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/are-for-loops-possibl...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 10 months
Drools + EMF + CDO
by Georg Maier
Hi,
I'm trying to figure out an issue for three days now and I'm getting kind of
desperate, so I hope someone can help.
I'm using Drools in combination with an EMF model which is modeling a
computer network. On init, I read the whole structure of the model and insert
all elements into the working memory. Some of the entities share the super
class "Device" which has an attribute "state".
Now I'm having the following rule to change an attribute of one of the model
entities:
rule "Set received status to model"
when
$event : SomeEvent (
$hostname : hostname,
$hoststate : hoststate,
$timestamp : timestamp
)
$device : Device (
name == $hostname
)
then
modify($device) {
setState($hoststate);
}
db.commit(false);
retract($event);
System.err.println("Set status of " + $device + " to " +
$hoststate);
end
... which works perfectly fine. Anyway, what I want to do in this test case
is to react whenever all child devices of a mutual parent device (e.g. hosts
on one switch) are no longer reachable. I thought of a rule like the
following:
rule "Parent Children Test"
when
$parent : Device (
$children : eContents,
eContents.size > 0
)
forall (
$child : Device (
state == "DOWN"
) from $children
)
then
...
end
... which by the way worked perfectly fine as long as I was not using objects
from a model. My first idea was that for some strange reason the object might
get copied so that I actually would have two different references after
modifying it, but this is not the case. When I initialize the rule base with
the circumstances that the second rule would fire, it really does. It just
seems as it would not being evaluated after changing the attribute, but this
is not the case either! So all I can think of is some strange caching, maybe
in combination with the forall statement? Maybe someone has some experience
when using Drools with EMF + CDO and experienced as similar issue?
Any help would be very very very much appreciated!
Thanks in advance
Georg
15 years, 10 months
Activation attempts of rules
by Georg Maier
Hi,
is there a way to observe (during runtime) when Drools evaluates the
condition of which rule, meaning when it "tries" to activate a rule?
I'm having a bug in my program and I can't determine whether objects are out
of sync, there is a mistake in my rule or (and I started believing in that)
that the rule is actually not re-evaluated, so this would be a great help for
debugging.
Thanks in advance!
Georg
15 years, 10 months