[rules-users] Data comparing in CONDITION column decision table
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.kara...@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@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Data comparing in CONDITION column decision table
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 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.kara...@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@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Data comparing in CONDITION column decision table
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.kara...@tcs.com From: Wolfgang Laun To: Rules Users List Date: 03/15/2012 02:47 PM Subject: Re: [rules-users] Data comparing in CONDITION column decision table
Re: [rules-users] Data comparing in CONDITION column decision table
On 15/03/2012, Sumeet Karawal 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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 02:47 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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 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.kara...@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@lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/rules-users >> > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Data comparing in CONDITION column decision table
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.kara...@tcs.com From: Wolfgang Laun To: Rules Users List Date: 03/15/2012 04:06 PM Subject: Re: [rules-users] Data comparing in CONDITION column decision table Sent by:rules-users-boun...@lists.jboss.org On 15/03/2012, Sumeet Karawal 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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 02:47 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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 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()| >> |--+---+
Re: [rules-users] Data comparing in CONDITION column decision table
Hi Wolfgang any other way to achieve this. I have tried many times, but no success till now :( Thanks, Sumeet From: Sumeet Karawal To: Rules Users List Date: 03/15/2012 04:24 PM Subject:Re: [rules-users] Data comparing in CONDITION column decision table Sent by:rules-users-boun...@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.kara...@tcs.com From: Wolfgang Laun To: Rules Users List Date: 03/15/2012 04:06 PM Subject: Re: [rules-users] Data comparing in CONDITION column decision table Sent by:rules-users-boun...@lists.jboss.org On 15/03/2012, Sumeet Karawal 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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 02:47 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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 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 | >> ---+--
Re: [rules-users] Data comparing in CONDITION column decision table
The documentation for 5.3.0 says To include a pattern without constraints, you can write the pattern in front of the text for another pattern. 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 wrote: > Hi Wolfgang > > any other way to achieve this. I have tried many times, but no success till > now :( > > Thanks, > Sumeet > > > > > From: Sumeet Karawal > > > To: Rules Users List > > > Date: 03/15/2012 04:24 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 04:06 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > > On 15/03/2012, Sumeet Karawal 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.kara...@tcs.com >> >> >> >> From: Wolfgang Laun >> >> >> To: Rules Users List >> >> >> Date: 03/15/2012 02:47 PM >> >> >> Subject:Re: [rules-users] Data comparing in CONDITION column > decision >> table >> >> Sent by:rules-users-boun...@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 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" >&g
Re: [rules-users] Data comparing in CONDITION column decision table
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 To: Rules Users List Date: 03/15/2012 05:30 PM Subject:Re: [rules-users] Data comparing in CONDITION column decision table Sent by:rules-users-boun...@lists.jboss.org The documentation for 5.3.0 says To include a pattern without constraints, you can write the pattern in front of the text for another pattern. 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 wrote: > Hi Wolfgang > > any other way to achieve this. I have tried many times, but no success till > now :( > > Thanks, > Sumeet > > > > > From: Sumeet Karawal > > > To: Rules Users List > > > Date: 03/15/2012 04:24 PM > > > Subject: Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 04:06 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > > On 15/03/2012, Sumeet Karawal 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.kara...@tcs.com >> >> >> >> From: Wolfgang Laun >> >> >> To: Rules Users List >> >> >> Date: 03/15/2012 02:47 PM >> >> >> Subject:Re: [rules-users] Data comparing in CONDITION column > decision >> table &
Re: [rules-users] Data comparing in CONDITION column decision table
Hi Instead of using a workaround, did you have a look to rule templates ? - under guvnor : http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-guvnor-docs/html_single/index.html#d0e1143 - drl : http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-expert-docs/html_single/index.html#d0e7501 You should be able to do exactly what you are trying to do, but properly, like that : template header field accno package range; template "Discount" rule "Discount @{row.rowNumber}" when Account( $v : @{field} != null ) $c : Customer( @{field} == $v , accno == @{accno} ) then $c.setDiscount(1); end end template - Mail original - De: "Sumeet Karawal" À: "Rules Users List" Envoyé: Jeudi 15 Mars 2012 14:20:01 Objet: Re: [rules-users] Data comparing in CONDITION column decision table 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 To: Rules Users List Date: 03/15/2012 05:30 PM Subject:Re: [rules-users] Data comparing in CONDITION column decision table Sent by:rules-users-boun...@lists.jboss.org The documentation for 5.3.0 says To include a pattern without constraints, you can write the pattern in front of the text for another pattern. 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 wrote: > Hi Wolfgang > > any other way to achieve this. I have tried many times, but no success till > now :( > > Thanks, > Sumeet > > > > > From: Sumeet Karawal > > > To: Rules Users List > > > Date: 03/15/2012 04:24 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@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.kara...@tcs.com > > > > From: Wolfgang Laun > > > To: Rules Users List > > > Date: 03/15/2012 04:06 PM > > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > > On 15/03/2012, Sumeet Karawal 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 : Custome
Re: [rules-users] Data comparing in CONDITION column decision table
This is true, but be aware that if a cell value in the Template data is empty the whole Fact Pattern is omitted. For example:- rule "Discount @{row.rowNumber}" when Account( $v : @{field} != null ) $c : Customer( @{field} == $v , accno == @{accno} ) then $c.setDiscount(1); end If "field" is empty neither "Account" or "Customer" will be included in the generated DRL. If "accno" is empty "Customer" will not be included in the generated DRL. This may have an impact on what you want to achieve. With kind regards, Mike On 19 March 2012 21:29, Vincent LEGENDRE wrote: > Hi > > Instead of using a workaround, did you have a look to rule templates ? > - under guvnor : > http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-guvnor-docs/html_single/index.html#d0e1143 > - drl : > http://docs.jboss.org/drools/release/5.4.0.Beta2/drools-expert-docs/html_single/index.html#d0e7501 > > You should be able to do exactly what you are trying to do, but properly, > like that : > > template header > field > accno > > package range; > > template "Discount" > rule "Discount @{row.rowNumber}" > when >Account( $v : @{field} != null ) >$c : Customer( @{field} == $v , accno == @{accno} ) > then >$c.setDiscount(1); > end > end template > > > - Mail original ----- > De: "Sumeet Karawal" > À: "Rules Users List" > Envoyé: Jeudi 15 Mars 2012 14:20:01 > Objet: Re: [rules-users] Data comparing in CONDITION column decision table > > 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 > > To: Rules Users List > > Date: 03/15/2012 05:30 PM > > Subject:Re: [rules-users] Data comparing in CONDITION column decision > table > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > The documentation for 5.3.0 says > > To include a pattern without constraints, you can write the pattern in > front of the text for another pattern. > > 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 wrote: > > Hi Wolfgang > > > > any other way to achieve this. I have tried many times, but no success > till > > now :( > > > > Thanks, > > Sumeet > > > > > > > > > > From: Sumeet Karawal > > > > > > To: Rules Users List > > > > > > Date: 03/15/2012 04:24 PM > > > > > > Subject:Re: [rules-users] Data comparing in CONDITION column > decision > > table > > > > Sent by:rules-users-boun...@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.kara...@tcs.com > > > > > > > > From: Wolfgang Laun > > > > > > To: Rules Users List > > > > > > Date: 03/15/2012 04:06 PM > > > > > > Subject:Re: [rules-users] Data comparing in CONDITION column > decision > > table > > > > Sent by:rules-users-boun...@lists.jboss.org > > > > > > > > > > > > > > > > On 15/03/2012, Sumeet Karawal wrote: > >> > >> How to make changes to the decision table entries to get a drl of this > >> kind: > >> > > > > Put > >$a: A
Re: [rules-users] Data comparing in CONDITION column decision table
Thanks for the warning, some old bugs appears clearer now !!! Is it planned in a near future to only exclude the constraint and not the whole fact pattern ? To me, it seems more accurate to do this way. Le 19/03/2012 22:57, Michael Anstis a écrit : This is true, but be aware that if a cell value in the Template data is empty the whole Fact Pattern is omitted. For example:- rule "Discount @{row.rowNumber}" when Account( $v : @{field} != null ) $c : Customer( @{field} == $v , accno == @{accno} ) then $c.setDiscount(1); end If "field" is empty neither "Account" or "Customer" will be included in the generated DRL. If "accno" is empty "Customer" will not be included in the generated DRL. This may have an impact on what you want to achieve. With kind regards, Mike ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Data comparing in CONDITION column decision table
To be honest there are no plans. Templates are implemented internally as MVEL templates and hence String manipulation. At this level concepts of "Pattern" and "Constraint" have no meaning and hence it is next to impossible to determine what impact a missing parameter value has. On 22 March 2012 09:40, Vincent Legendre wrote: > Thanks for the warning, some old bugs appears clearer now !!! > > Is it planned in a near future to only exclude the constraint and not the > whole fact pattern ? > To me, it seems more accurate to do this way. > > Le 19/03/2012 22:57, Michael Anstis a écrit : > > This is true, but be aware that if a cell value in the Template data is > empty the whole Fact Pattern is omitted. > > For example:- > > rule "Discount @{row.rowNumber}" > when > Account( $v : @{field} != null ) > $c : Customer( @{field} == $v , accno == @{accno} ) > then > $c.setDiscount(1); > end > > If "field" is empty neither "Account" or "Customer" will be included in > the generated DRL. > > If "accno" is empty "Customer" will not be included in the generated DRL. > > This may have an impact on what you want to achieve. > > With kind regards, > > Mike > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users