[rules-users] Function call from LHS in Drools

Mohod, Akash Akash.Mohod at morganstanley.com
Tue Jan 18 03:10:33 EST 2011


Thanks a lot Wolfgang.

Regards,
Akash


From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: Monday, January 17, 2011 9:27 PM
To: Rules Users List
Subject: Re: [rules-users] Function call from LHS in Drools

when
                System ($users: users)
                $user : User () from $users
                eval ( "SuperUser".equals( HelperFunction.getUserType($user) ) )

You just cannot bind the result of a method/function call to a variable. Inside eval, you are in Java country, so don't use ==.

-W

2011/1/17 Mohod, Akash <Akash.Mohod at morganstanley.com<mailto:Akash.Mohod at morganstanley.com>>
Hi,

I want to do something like this in my rule : -

when
                System ($users: users)
                $user : User () from $users
                $userType : HelperFunction.getUserType($user)
                eval($userType == "SuperUser")
then
                System.out.println(" User Type is " + $userType);
end

The idea is I want to get the type of user using a static function call in the LHS. Is it possible to do so in the LHS.
I am using Drools 5.1 .

Regards,
Akash



________________________________
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.

_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org<mailto:rules-users at lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users


--------------------------------------------------------------------------
NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or views contained herein are not intended to be, and do not constitute, advice within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer Protection Act. If you have received this communication in error, please destroy all electronic and paper copies and notify the sender immediately. Mistransmission is not intended to waive confidentiality or privilege. Morgan Stanley reserves the right, to the extent permitted under applicable law, to monitor electronic communications. This message is subject to terms available at the following link: http://www.morganstanley.com/disclaimers. If you cannot access these links, please notify us by reply message and we will send the contents to you. By messaging with Morgan Stanley you consent to the foregoing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110118/e4f45d1d/attachment.html 


More information about the rules-users mailing list