Mat,
The option of binding and setting variables is already available in 4.0.1 GA
release of the BRMS. I've just replied to a similar post. Suppose you've
already defined some "when" constraint on an object of type Person and you
want to set the attribute name in the Then part:
When you define your When 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
When 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 options allows you to pick the variable p you
just created - choose the second option if you want to update p into the
Working memory after modifying it. 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 (e.g. name). What this does is actually call
the method called setName (Press View Source button to see). The Set action
should now have a text box where you can enter the name parameter
Regards
Shahad
On 10/3/07, Drouin.Mathieu <Mathieu.Drouin(a)cic.gc.ca> wrote:
Ok, I've read the rules, seems like I was infringing on #11. I might be
violating #3 by sending this one though :)
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/
trunk/target/docs/shared/images/Chapter-Examples/BRMS_Guided.png
Is the guided editor with variable binding (shown above) going to be
available in v.4.0.2? If not, is it possible to achieve a similar result
without the help of DSL?
Thanks,
Mat
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users