[rules-users] Need Syntax help for a string match

Lindy hagan lindyhagan at gmail.com
Wed Nov 18 11:07:22 EST 2009


Yes Rete Tree is identical for both the structures. Will go with one of the
scenarios given below , instead of going with Regex.

rule "Test"
when
t : Thing( foo == "BAR" || == "BAS" );
then
System.out.println( "meh" );
end

rule "Test"
when
t : Thing( foo in("BAR","BAS") );
then
System.out.println( "meh" );
end

Adding to my initial question , based on the condition satisfied how can I
set a variable to "Y"in a different object (Other than
customer)?customerDetail is not static.

rule "Age Factor"
     when
          m : Customer( age matches "18,21,33,28,40,41")
     then
         System.out.println("Customer falls in age group ");
         // doAgeTasks();
       customerDetail.setFallsInAgeGroup("Y");  -- Need to do something like
this.How can I do this?
end

On Tue, Nov 17, 2009 at 4:13 PM, Lindy hagan <lindyhagan at gmail.com> wrote:

> Thanks for the quick reply.Will look into regex.
>
> 2009/11/17 Mauricio Salatino <salaboy at gmail.com>
>
> Or just find how to write a regex to match all that numbers:
>> Using matches and
>> http://java.sun.com/docs/books/tutorial/essential/regex/
>>
>>
>> On Tue, Nov 17, 2009 at 6:50 PM, Mauricio Salatino <salaboy at gmail.com>wrote:
>>
>>> I think that you can do something like:
>>>
>>> m : Customer( age == "18" || =="21" || =="33" || =="28" || =="40" ||
>>> =="41")
>>>
>>> 2009/11/17 Lindy hagan <lindyhagan at gmail.com>
>>>
>>>>
>>>> Need to do some tasks if customers age is in 18,21,33,28,40,41. Can't
>>>> use contains as age is a string value.Could any one help me out. Below rule
>>>> does not work.
>>>>
>>>>
>>>> rule "Age Factor"
>>>>      when
>>>>           m : Customer( age matches "18,21,33,28,40,41")
>>>>      then
>>>>          System.out.println("Customer falls in age group ");
>>>>           doAgeTasks();
>>>> end
>>>>
>>>> Thanks,
>>>> Lindy.
>>>>
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> rules-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>>
>>>>
>>>
>>>
>>> --
>>> - http://salaboy.wordpress.com
>>> - http://www.jbug.com.ar
>>> - Salatino "Salaboy" Mauricio -
>>>
>>
>>
>>
>> --
>> - http://salaboy.wordpress.com
>> - http://www.jbug.com.ar
>> - Salatino "Salaboy" Mauricio -
>>
>> _______________________________________________
>> 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/20091118/301e115d/attachment.html 


More information about the rules-users mailing list