Opps the file has not attached.
<?xml version="1.0"?>
<rule-set name="GetRanking"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd">
<application-data identifier="count">
java.lang.Integer
</application-data>
<rule name="Rule 1" salience="100">
<parameter identifier="str">
<class>java.lang.String</class>
</parameter>
<java:condition>true</java:condition>
<java:consequence>
if(count == null){
count = new Integer(0);
}
System.out.println(count.intValue());
</java:consequence>
</rule>
<rule name="Rule 2" salience="90">
<parameter identifier="str">
<class>java.lang.String</class>
</parameter>
<java:condition>true</java:condition>
<java:consequence>
if(count != null){
System.out.println(count.intValue());
}
System.out.println(count);
</java:consequence>
</rule>
</rule-set>
----- Original Message -----
From: Amit Jain
To: [email protected]
Sent: Wednesday, November 16, 2005 2:39 PM
Subject: Re: [drools-user] Data Sharing in rules
Thanks for ur reply Mark but I am not getting the expected result. I have
attached a demo rule file to test application data.
Please have a look at the attached demo rule file where I have used
application data. I changed the value of count(global variable) to Integer(0)
in Rule 1 and I am getting null in Rule 2.
here is the outcome when the rules are fired.
0
null
Please see where am I making mistake.
With Regards
Amit
----- Original Message -----
From: "Mark Proctor" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, November 16, 2005 1:13 PM
Subject: Re: [drools-user] Data Sharing in rules
> application data is global - you might be having problems with immutable
> objects.
> Amit Jain wrote:
> > HI!
> >
> > I need a variable which i want to use in all my rules. If i change the
value
> > of this variable it should be vissible in other rules as well. Is it
> > possible to do something like that in rule file. I tried to use
application
> > data but the value its changed in one rule is nto vissible in other.
> >
> > With Regards
> > Amit
> >
> >
> >
> >
> >
>