[rules-users] inserting multiple facts in RHS

Wolfgang Laun wolfgang.laun at gmail.com
Thu Oct 27 16:51:53 EDT 2011


If globalService.getCustomObjects() returns a collection then there is no
point in doing a from/collect to iterate and collect (again) what was a
collection to start with.

Simply use
   for (Object obj: globalService.getCustomObjects()) insert(obj);

-W


2011/10/27 Michael Anstis <michael.anstis at gmail.com>

> Why not get get List using "from" in the LHS and iterate this in the RHS
> adding individual facts?
>
>
> On 27 October 2011 21:39, RK <rmeiappan at datacert.com> wrote:
>
>> I want to insert multiple facts sourced by a 'from' clause to a service
>> method.
>> For Ex:
>>
>> when
>> ...
>> then
>>  insert( mycustomobject() from globalService.getCustomObjects())
>>
>> getCustomObjects() method will return several instances of custom objects
>> based on a sql query and i want to insert them into the knowledge session.
>> I'll be using these custom objects in other subsequent rules.
>>
>> Is it possible to do something like this ?
>>
>> Thanks
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/inserting-multiple-facts-in-RHS-tp3459071p3459071.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
>>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111027/41b4033e/attachment.html 


More information about the rules-users mailing list