On Thu, Oct 18, 2018 at 2:30 PM Christian Sakowski <
christian.sakow...@heubach-media.de> wrote:
>
> > I did not find a way how to do a shared collection from selection,
>
> You don’t need this. Just pass the object into the process. The object
will be copied.
> If you have performance problems, please let me know your benchmarks.


My testing data have now 15 record, so it will take a while.
>
>
> > creates unordered selection, so order is lost. ds.Table.fromCollection
may do that, but at a cost of significant overhead.
>
> Yes indeed.
>
> I create an ordered selection from a collection by doing this:
>
> ARRAY LONGINT($ids;0)
> COLLECTION TO ARRAY($collection;$ids)
>
> QUERY WITH ARRAY([table]ID;$ids)
> ORDER BY FORMULA([table];Find in array($ids;[table]ID))
>

Following code seems to work:

$selection:=ds.Table.newSelection(dk keep ordered)
For each ($id;$collection)
  $selection.add(ds.Table.get($id))
End for each

--

Peter Bozek
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to