[rules-users] Define global variables at the top of a rules file

Martin A wmlsub at gmail.com
Sat Oct 22 15:29:36 EDT 2011


Hi, Wolfgang,

I was not aware of this sophisticated way of handling conditions in Drools
:) Maybe I've missed this part in the documentation :)

Thanks for your response,
Martin

2011/10/22 Wolfgang Laun <wolfgang.laun at gmail.com>

> There is no way the truth of true can be changed and, by definition, when
> there is no change in the condition there is no chance for another firing of
> the rule. All Production Systems are alike in this respect.
> -W
>
>
> 2011/10/22 Martin A <wmlsub at gmail.com>
>
>> Hello,
>>
>> Thanks for your response!
>>
>> But I don't understand why such a rule with a high salience which looks
>> like:
>>
>> global int VARIABLE;
>>
>> rule "init"
>>   salience 999;
>>   when
>>     (eval(true))
>>   then
>>     VARIABLE = 1;
>> end
>>
>> would fire only once?
>>
>> Thank you,
>> Martin
>>
>>
>> 2011/10/20 Wolfgang Laun <wolfgang.laun at gmail.com>
>>
>>> You can do this by setting the global from a high salience rule from
>>> within your DRL. Leave the conition empty - such a rule only fires once.
>>> -W
>>>
>>> 2011/10/20 Martin A <wmlsub at gmail.com>
>>>
>>>> Hello,
>>>>
>>>> I'd like to set global rules variables at the top of a rules file, like
>>>> so:
>>>>
>>>> global int WELCOME_SCREEN = 1;
>>>>
>>>> so that I may easily refer to them from inside the rules, instead of
>>>> hardcoding them somewhere in code. Is this possible?
>>>>
>>>> Best regards,
>>>> Martin
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111022/0d8d15c8/attachment.html 


More information about the rules-users mailing list