[rules-users] Retriving an Object Array in the when clause of a rule.
Wolfgang Laun
wolfgang.laun at gmail.com
Mon Jun 18 02:36:29 EDT 2012
See below.
On 18/06/2012, Amal Gupta <Amal_Gupta at infosys.com> wrote:
> Hi All,
>
> Is there a way to retrieve an object array from a Class getter in the when
> clause of a rule in a drl file ? I have tried a lot of things but they did
> not work out.
What about reading the Expert manual? Did you try that?
[snip]
> rule "SourceSystemId = value"
>
> when
>
> c: EightColumnGenericClass()
> Object[] columns: c.getColumn1();
This is incorrect syntax: you cannot declare an array to bind to
("columns"), and you cannot simply use an arbitrary expression to be
bound to a variable.
> for (Object o : columns)
> {
> System.out.println(o.toString());
> # The condition I want here is - if (o.toString()=="1794")
> }
You most certainly can't use for or similar action statements on the LHS!
> then
>
> #RHS Code
> end
>
> Is there a way to achieve this? Or is there something missing with my DRL
> file? Please assist.
>
rule x
when
$c: EightColumnGenericClass()
$o: Object() from $c.getColumn1()
eval( $o.toString().equals( "1794" ) )
then
...
end
-W
More information about the rules-users
mailing list