[rules-users] String comparison question

Edson Tirelli tirelli at post.com
Tue Jun 2 08:58:25 EDT 2009


   It works, but it is not idea, because drools cannot index the constraints
used inside an eval. If you are testing for equals, better to use regular
constraints.

   []s
   Edson

2009/6/2 Nagaraju runkana <runkana.nagaraju at gmail.com>

> Try like this..it's working fine.
>
> $c :CashMemoDtl(articleCode:articleCode)
> eval($c.getArticleCode().equals( "Laptop")  &&  $c.getArticleCode().equals(
> "Mouse")  )
>
> Thanks,
> -Manya
>
> 2009/6/1 Armaghan Mahmud <mahmud.armaghan at gmail.com>
>
>> Hey guys,
>>
>> I read in a previous post that == in Drools 4.0.7 maps to .equals()
>> automatically. My situation required me to put a String object into the
>> working memory and do a comparison on it to see if a particular word is in
>> the passed String sentence. Could anybody please guide me as to how to
>> approach this problem? Thanks in advance. Here's my original code:
>>
>>
>> rule "Find Alpha in a sentence"
>> *
>>
>> salience
>> * 100
>>
>> wrap: WrapperClass(Sentence == "Alpha")
>>
>> then
>>
>> System.out.*println*("Aha found ya!");
>>
>> end
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090602/c289d83e/attachment.html 


More information about the rules-users mailing list