[rules-users] Accessing items in a list

Wolfgang Laun wolfgang.laun at gmail.com
Wed Dec 11 02:15:08 EST 2013


On 10/12/2013, mkhan <mushtaq.khan at alstom.com> wrote:
> Hi,
> I am  new to doorls so please can you help me.
> I am trying to access an ietm from a list in a rule like ...
>
> $data: List(this != null, size > 9) from accumulate(
> 	$obj1 : FwVehicle(
> 		notchCodingWire1 != null,
> 		lineVoltage != null
> 	)
> 	over window:time(10s)
> 	from entry-point "DataStream",
> 	collectList($obj1)
> )
>
> $first : $data.get(0)
>
> but i get an error ...
> [ERR 102] Line 164:19 mismatched input '0' expecting ')' in rule "test1" in
> pattern $data.get
>
> Does anyone have any ideas what I am doing wrong please?

It's a case of incorrect syntax. "xxx.yyy(zzz)" looks like a pattern
for a fact of type xxx.yyy to the engine, and zzz can't be an integer
literal. You can use $data.get(0) in a (Java) expression, though, but
there's Not enough context shown for more constructive and conclusive
advice.

-W


>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Accessing-items-in-a-list-tp4027194.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list