[rules-users] Data comparing in CONDITION column decision table

Sumeet Karawal sumeet.karawal at tcs.com
Thu Mar 15 09:20:01 EDT 2012


I inserted Account column with values that are always true.

Works fine. :)

Will try the same with 5.3 .

Thanks & Regards,
Sumeet



                                                                                                                                  
  From:       Wolfgang Laun <wolfgang.laun at gmail.com>                                                                             
                                                                                                                                  
  To:         Rules Users List <rules-users at lists.jboss.org>                                                                      
                                                                                                                                  
  Date:       03/15/2012 05:30 PM                                                                                                 
                                                                                                                                  
  Subject:    Re: [rules-users] Data comparing in CONDITION column decision table                                                 
                                                                                                                                  
  Sent by:    rules-users-bounces at lists.jboss.org                                                                                 
                                                                                                                                  





The documentation for 5.3.0 says
<quote>
To include a pattern without constraints, you can write the pattern in
front of the text for another pattern.
</quote>
but it does not work with 5.2.0 and (likely) later versions.

As a workaround, re-insert the Account column and use a redundant
condition that is certainly true for all facts.

I'll have to look into this.

-W


On 15/03/2012, Sumeet Karawal <sumeet.karawal at tcs.com> wrote:
> Hi Wolfgang
>
> any other way to achieve this. I have tried many times, but no success
till
> now :(
>
> Thanks,
> Sumeet
>
>
>
>
>   From:       Sumeet Karawal <sumeet.karawal at tcs.com>
>
>
>   To:         Rules Users List <rules-users at lists.jboss.org>
>
>
>   Date:       03/15/2012 04:24 PM
>
>
>   Subject:    Re: [rules-users] Data comparing in CONDITION column
decision
> table
>
>   Sent by:    rules-users-bounces at lists.jboss.org
>
>
>
>
>
>
>
>
>
> After doing the changes, its taking the rules as:
>
> rule "Discount_10"
> 		 		  when
> 		 		  		 		  $a:Account(type ==
$a.getType(), accno == 1001)
> $c:Customer
> 		 		  then
> 		 		  		 		  $c.setDiscount(1);
> end
>
>
> and if I put it as $a: Account() $c: Customer(), it takes the rules as:
>
> rule "Discount_10"
> 		 		  when
> 		 		  		 		  $a:Account(type ==
$a.getType(), accno == 1001)
> $c:Customer()
> 		 		  then
> 		 		  		 		  $c.setDiscount(1);
> end
>
> Both these throw error..
>
>
>
> neither putting the $c:Customer before $a:Account is getting executed.
>
>
> Thanks & Regards,
> Sumeet
> Mailto: sumeet.karawal at tcs.com
>
>
>
>   From:       Wolfgang Laun <wolfgang.laun at gmail.com>
>
>
>   To:         Rules Users List <rules-users at lists.jboss.org>
>
>
>   Date:       03/15/2012 04:06 PM
>
>
>   Subject:    Re: [rules-users] Data comparing in CONDITION column
decision
> table
>
>   Sent by:    rules-users-bounces at lists.jboss.org
>
>
>
>
>
>
>
> On 15/03/2012, Sumeet Karawal <sumeet.karawal at tcs.com> wrote:
>>
>> How to make changes to the decision table entries to get a drl of this
>> kind:
>>
>
> Put
>    $a: Account() $c: Customer
> into the cell where you now have $c : Customer and delete the Account
> column.
> -W
>
>>
>> rule "Discount_10"
>> 		 		  		 		   when
>>
	 		   $a : Account()
>>
	 		   $c : Customer(type ==
> $a.getType(), accno == 1001)
>> 		 		  		 		   then
>>
	 		   $c.setDiscount(1);
>> end
>>
>>
>> Thanks,
>> Sumeet
>> Mailto: sumeet.karawal at tcs.com
>>
>>
>>
>>   From:       Wolfgang Laun <wolfgang.laun at gmail.com>
>>
>>
>>   To:         Rules Users List <rules-users at lists.jboss.org>
>>
>>
>>   Date:       03/15/2012 02:47 PM
>>
>>
>>   Subject:    Re: [rules-users] Data comparing in CONDITION column
> decision
>> table
>>
>>   Sent by:    rules-users-bounces at lists.jboss.org
>>
>>
>>
>>
>>
>>
>>
>> Line breaks were lost in transit, but I think that you should remove
>> the quotes from
>>
>>    type == "$param"
>>
>> if you insert an expression $a.getType().
>>
>> -W
>>
>>
>> On 15/03/2012, Sumeet Karawal <sumeet.karawal at tcs.com> wrote:
>>>
>>> Hi,
>>>
>>> Can we use a data value of another object in the condition column of a
>>> Spreadsheet.
>>>
>>> For example: I have two data types(POJOs) one com.bank.Customer and
> other
>>> com.bank.Account
>>>
>>> in the rules I want to check whether the value entered for a particular
>>> field in Customer class is equal to the value entered for the
>> corresponding
>>> field in the Account class. eg Customer.accType = Account.accType()
>>>
>>>
>>> How can we achieve this using Decision table (CONDITION Column). I have
>>> tried this:
>>>
>>>             --------------------------------------------
>>>            |RuleTable
>>>            |Discount
>>>             --------------------------------------------
>>>            |CONDITION      |CONDITION                   |
>>>             ---------------+----------------------------|
>>>            |$a : Account   |$c : Customer               |
>>>             ---------------+----------------------------|
>>>            |               |type == "$param"
>>>  ----------+---------------+----------------------------
>>> | Discount |    Account    |            Type            |
>>> |  Rules   |               |                            |
>>> |----------+---------------+----------------------------|
>>> |    1     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>> |    2     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>> |    3     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>> |    4     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>> |    5     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>> |    6     |               |        $a.getType()        |
>>> |----------+---------------+----------------------------|
>>>
>>>
>>>
>>>
>>> But it won't work. It would be great if somebody could help me on this.
>>>
>>> Thanks & Regards,
>>> Sumeet Karawal
>>> Mailto: sumeet.karawal at tcs.com
>>>
>>> =====-----=====-----=====
>>> Notice: The information contained in this e-mail
>>> message and/or attachments to it may contain
>>> confidential or privileged information. If you are
>>> not the intended recipient, any dissemination, use,
>>> review, distribution, printing or copying of the
>>> information contained in this e-mail message
>>> and/or attachments to it are strictly prohibited. If
>>> you have received this communication in error,
>>> please notify us by reply e-mail or telephone and
>>> immediately and permanently delete the message
>>> and any attachments. Thank you
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>
>
>
>
> _______________________________________________
> 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







More information about the rules-users mailing list