Hello,

Please give me advice for best way storing global variables.

global java.lang.Integer res;
global java.lang.Integer res2;
...

I've several number of rules. One rule has variable initialization e.g.:

...
rule "AmountsAreNotNull" salience 20
    when
        < conditions >
    then
       ...
        res = new Integer(a.compareTo(new BigDecimal(25)));
        res = (res == -1)?0:res;
        res = (res == -1)?0:res;
        res2 = new Integer(a.compareTo(b));
        res2 = (res2 == -1)?0:res2;
       ...
end

The values of these variables are proper and equal 1

Then next rule has comparing for res|res2 values, but they have lost their values (res == null and res2 == null)

rule "CompareValues" salience 10
    when
        res:Integer(intValue == 0)
        res2:Integer(intValue == 0)
        result:List()
    then
        result.add(Boolean.TRUE);
end

What decision you can advise me to save variables value between rules?
Thanks.
____________________
Regards,
Komissarov Alexander
mail: aleks.komissarov@gmail.com
icq: 239128267