[rules-users] How do I access objects in a top level or condition?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[rules-users] How do I access objects in a top level or condition?

Chidambaran Subramanian
rule "Test"
  dialect "mvel"
  when
    ( Customer( age == 50 ) or Deal( amount == 30 ) )
  then
    Customer.setAge( "40" );
    update( Customer );
    Customer.setPlace( "Test" );
    update( Customer );
end



Appreciate any help in this regard.

Regards
Chiddu

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users
Reply | Threaded
Open this post in threaded view
|

Re: [rules-users] How do I access objects in a top level or condition?

salaboy
Hi, you can't because you don't know which is true. 
You can create two rules one for each condition
and then you can access by binding the Conditaional Element to a variable:
Like for example:

when
    $c: Customer( age == 50 )
  then
    $c.setAge( "40" );


On Wed, May 28, 2014 at 3:39 PM, Chidambaran Subramanian <[hidden email]> wrote:
rule "Test"
  dialect "mvel"
  when
    ( Customer( age == 50 ) or Deal( amount == 30 ) )
  then
    Customer.setAge( "40" );
    update( Customer );
    Customer.setPlace( "Test" );
    update( Customer );
end



Appreciate any help in this regard.

Regards
Chiddu

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users



--
 - MyJourney @ http://salaboy.com
 - Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar
 
 - Salatino "Salaboy" Mauricio -

_______________________________________________
rules-users mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/rules-users