Field to Collection

I’d like to get an Object field into a Collection for use in a Listbox.
The code below works, but it seems like there should be a more direct way to get the collection “$cents”.
entitySelection.toCollection( ) sounds promising, but isn’t working (for me) to get a field to a collection.

Does anyone see a shorter path?

$vents:=ds.Table.all( )
REDUCE SELECTION([Table];0)
USE ENTITY SELECTION($vents)
ARRAY OBJECT($aObj;0)
SELECTION TO ARRAY([Table]Obj;$aObj)
$cents:=New collection
ARRAY TO COLLECTION($cents;$aObj)

Thanks,

do you want to display the object field as an entity selection or as an array of objects?

hint:

an entity selection is a class of object, which can be displayed in a collection type list box

e.g.

$selection:=ds[$dataClass].all()

$selection, which is an entity selection, which is an object, qualifies as a listbox data source.

e.g.

$collection:=ds[$dataClass].all().toCollection(“fieldA”;“fieldB”;“fieldC”)

$collection, which is a collection, where each element is an object, also qualifies as a listbox data source.

one important aspect of ORDA is that it is an abstraction layer.

the listbox (V of MVC) works the same way for entity selections and collections (M of MVC)

Since the source of the listbox is in the object field of the record, the object field must be sent to the collection.
A record’s definition and data are in the object field rather than in separate fields of the record.
You can see in the Results section of the attached example that toCollection adds an extra “level” to the resulting collection.

Using toCollection, I guess the question is what is the fastest way to get the results of toCollection (cents[n].Obj) to its own collection?

Thanks for the input,

http://forums.4d.com/4DBB_Main/x_User/1153451/files/26324668.pdf

OK - that would be

cents:=ds.Vals.query(“Link_Form = :1”;$searchFor).toCollection(“Obj”).extract(“Obj”;ck keep null)

for the new style, solution.

Thanks again…