when I do this I am getting the below error:
Exception in thread "main" java.lang.RuntimeException: Unable to Analyse
Expression $a.getType():
[Error: unable to resolve method using strict-mode:
com.example.model.Customer.$a()]
[Near : {... $a.getType() ....}]
^
[Line: 1, Column: 1] : [Rule name='Discount_10']
Unable to Analyse Expression $a.getType():
[Error: unable to resolve method using strict-mode:
com.example.model.Customer.$a()]
[Near : {... $a.getType() ....}]
^
[Line: 1, Column: 1] : [Rule name='Discount_11']
Unable to Analyse Expression $a.getType():
[Error: unable to resolve method using strict-mode:
com.example.model.Customer.$a()]
[Near : {... $a.getType() ....}]
^
[Line: 1, Column: 1] : [Rule name='Discount_12']
|--------------------------------------------
|RuleTable
|Discount
|--------------------------------------------
|CONDITION |CONDITION |
|---------------+----------------------------|
|$a : Account |$c : Customer |
|---------------+----------------------------|
| |type == $param
|---------------+----------------------------
| Account | Type |
|---------------+----------------------------|
| | $a.getType() |
|---------------+----------------------------|
| | |
|---------------+----------------------------|
| | |
|---------------+----------------------------|
| | |
|---------------+----------------------------|
| | |
|---------------+----------------------------|
| | |
|---------------+----------------------------|
Howerver, when I include the following in the decision table:
|--------------------------------------------
|RuleTable
|Discount
|--------------------------------------------
|CONDITION |CONDITION |
|---------------+----------------------------|
|$a : Account |$c : Customer |
|---------------+----------------------------|
|type |type == $param
|---------------+----------------------------
| Account | Type |
|---------------+----------------------------|
| savings | $a.getType() |
|---------------+----------------------------|
| current | |
|---------------+----------------------------|
| savings | |
|---------------+----------------------------|
| current | |
|---------------+----------------------------|
| savings | |
|---------------+----------------------------|
| current | |
|---------------+----------------------------|
I am getting correct result. But here I don't want to check for the type
entered for Account class.
The generated drl is like this:
rule "Discount_10"
when
$c : Customer(type == $a.getType(), accno == 1001)
then
$c.setDiscount(1);
end
How to make changes to the decision table entries to get a drl of this
kind:
rule "Discount_10"
when
$a : Account()
$c : Customer(type == $a.getType(), accno == 1001)
then
$c.setDiscount(1);
end
Thanks,
Sumeet
Mailto: sumeet.karawal(a)tcs.com
From: Wolfgang Laun <wolfgang.laun(a)gmail.com>
To: Rules Users List <rules-users(a)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(a)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(a)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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users