Skip to main content
Version: Next

Create entity selection

*Create entity selection ( dsTable : Table { ; settings : Object } ) : 4D.EntitySelection

ParameterTypeDescription
dsTableTableTable in the 4D database whose current selection will be used to build the entity selection
settingsObjectBuild option: context
Function result4D.EntitySelectionEntity selection matching the dataclass related to the given table

Description

The Create entity selection command builds and returns a new, alterable entity selection related to the dataclass matching the given dsTable, according to the current selection of this table.

If the current selection is sorted, an ordered entity selection is created (the order of the current selection is kept). If the current selection is unsorted, an unordered entity selection is created.

If the dsTable is not exposed in ds, an error is returned. This command cannot be used with a Remote datastore.

In the optional settings parameter, you can pass an object containing the following property:

PropertyTypeDescription
contextTextLabel for the optimization context applied to the entity selection.

Example

var $employees : cs.EmployeeSelection
ALL RECORDS([Employee])
$employees:=Create entity selection([Employee])
// The $employees entity selection now contains a set of reference
// on all entities related to the Employee dataclass

See also

USE ENTITY SELECTION
dataClass.newSelection()