Thanks for your help , Sudhir,
I used
rule
when $a:A(b.z.s=="test");
then
end
And that solved my problem.
But I would like to know one more information about global variables.
package...
dialect java
import ..,
global java.lang.String recipients="divya(a)gmail.com"
global java.lang.String to="xyz(a)yahoo.com"
global java.lang.String cc="abc(a)gmail.com"
rule
when when $a:A(b.z.s=="divya");
then
$a.setRecipients(recipients);
$a.setTo(to);
$a.setCC(cc);
update($a)
end
Is this feasible with Drools. I get
unable to comile myfile.drl file
[9,40]: unknown:9:40 mismatched token: [@49,201:201='=',<71>,9:40];
E
exception. Could you please help me with this too.
Thanks
-D
Sudhir M-2 wrote:
Hi D,
I don't know which version of drools are you using. If u are using drools
4
or higher you can use 'from' to write rules on nested objects. All u need
to do is insert the root pbject in the working memory
Regards,
sudhir.
On Mon, Feb 23, 2009 at 2:56 PM, Divya Rajendranath <
divya.rajendranath(a)gmail.com> wrote:
> Hi,
>
> I am planning to use Drools - JBoss Rules Engine. My requirement is to
> disburse mails from my application to different groups based on various
> criteria. I want to use Drools here.
>
> My object structure is as follows:
>
> class A{
>
> String B = "";
>
> B b;
>
> C c;
> }
>
> Hence Obj A has embedded objects within it, and obj B and C further has
> embedded objects.
>
> class B {
>
> String X;
>
> Z z;
>
> }
>
> class Z{
>
> String t;
>
> String s;
>
> }
>
> The decision on sending the mails based on the fields in embedded objects
> of A. I pass instance of A to Drools
>
> Format of drl file:
>
> package...;
>
> import ..;
>
> rule "Test"
>
> when $a:A(B(Z(s == "testvalue")))
>
> then
>
> $a.setSomething();
>
> update($a);
>
> end
>
> I wanted to know if this (accessing fields in embedded/child object) is
> feasible with Drools.
>
> I get an error saying "UNable to compile myfile.drl when i try to fo
> this.
>
> Could some one look into this issue and let me know the reason for this ?
>
>
>
> Thanks
>
> -D
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
View this message in context:
http://www.nabble.com/Help-on-using-Drools-with-embedded-objects-tp221580...
Sent from the drools - user mailing list archive at
Nabble.com.