[rules-users] BRMS - how to use variables on Action part?

Felipe Piccolini felipe.piccolini at bluesoft.cl
Thu Oct 4 22:26:38 EDT 2007


Shahad,

    Thanks for the complete guide, but I already did all that, the  
problem is in the text box on the set/update action part... I cant  
enter any text there, just numbers or 1.2
and I assume is a restriction because the field was declared as  
Number type (Long or Double). If i declare the field as String the  
text box let me enter any text, but it
sorrounds it with "" so the text is converted to a String when I see  
the code (view source).

Thanks anyways. Trying to define a formula on the LHS (where it can  
be defined) didnt help me because I dont know how to use it.

On 04-10-2007, at 11:17, Shahad Ahmed wrote:

> Hi Felipe,
>
> When you define your LHS in the BRMS, there is an option to assign  
> a variable to the expression. In the When part, there should be a  
> little green triangle beside Person. Click on this to get a dialog  
> called "Modify constraints for Person". At the bottom of this  
> dialog is an option to set a variable name to bind to Person. Type  
> p, or whatever you want into the text box and then click the Set  
> button beside the text box. You should now have a LHS constraint of  
> the form p:Person(...). Now create a Then action by clicking the +  
> at the RHS of the Then part. A dialog will appear called "Add a new  
> action". The first two option allows you to pick the variable p you  
> just created - you probably want the second option of "modify a  
> fact" as you want to call update(p) after modifying p. You should  
> now see something like Set [p] in the Then part. Click on the Green  
> triangle above Set [p] and you will get a dialog called "Add a  
> field" with a list of the fields in the Person class. Choose the  
> one you want to set (approvedMount?). What this does is actually  
> call the method called setApprovedMount (Press View Source button  
> to see). The Set action should now have a text box where you can  
> enter the parameter $income * 1.2.
>
> I've had a look at the source code for this functionality and it  
> only allows Setter methods to be called - unfortunately you cannot  
> call any other methods on Person.
>
> Regards
> Shahad
>
>
>
> On 10/3/07, Felipe Piccolini <felipe.piccolini at bluesoft.cl> wrote:
> Ok, so to fit on the "not ignored emails" from the list Mark  
> posted, I changed the title. However I following in the list
> anyways beacuse Im resending this email in less than 3 days.
>
>
> Note: Im not desperate, nor this is for today. This just came out  
> today yesterday and well... its important to me, but I
> think I can get a work around for now.
>
>
> So here is the real on-topic question.
> -----------------
> Anyone knows how to use variables (from fields) setted on LHS, to  
> modify a field on the RHS using the GUI editor
> from BRMS?
>
>
> What I need is to write this rule on BRMS.
>
>
> rule "Set approvedMount for a women"
> no-loop true
> when
> $p: Person($sex: sex == "F", $income: incomeMount)
> then
> $p.setApprovedMount($income * 1.2);
> update ($p);
> end
>
>
> I know I can use formulas, but I only know how to set those on LHS,  
> I dont know how to put a formula on RHS (setter of the field to  
> modify).
>
>
> Thanks.
>
>
> Felipe Piccolini M.
> felipe.piccolini at bluesoft.cl
>
>
>
>
>
>
>
>
> _______________________________________________
> 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


Felipe Piccolini M.
felipe.piccolini at bluesoft.cl




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071004/056be709/attachment.html 


More information about the rules-users mailing list