This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v19.8
entitySelection.distinct( )
|
entitySelection.distinct ( attributePath {; option} ) -> Result | ||||||||
Parameter | Type | Description | ||||||
attributePath | Text |
![]() |
Path of attribute whose distinct values you want to get | |||||
option | Longint |
![]() |
dk diacritical: diacritical evaluation ("A" # "a" for example) | |||||
Result | Collection |
![]() |
Collection with only distinct values | |||||
The entitySelection.distinct( ) method returns a collection containing only distinct (different) values from the attributePath in the entity selection.
The returned collection is automatically sorted. Null values are not returned.
In the attributePath parameter, pass the entity attribute whose distinct values you want to get. Only scalar values (text, number, boolean, or date) can be handled. If the attributePath is an object attribute that contains values of different types, they are first grouped by type and sorted afterwards. Types are returned in the following order:
By default, a non-diacritical evaluation is performed. If you want the evaluation to be case sensitive or to differentiate accented characters, pass the dk diacritical constant in the option parameter.
An error is returned if:
You want to get a collection containing a single element per country name:
C_COLLECTION($countries)
$countries:=ds.Employee.all().distinct("address.country")
Product: 4D
Theme: ORDA - EntitySelection
Created: 4D v17
4D Language Reference ( 4D v19)
4D Language Reference ( 4D v19.1)
4D Language Reference ( 4D v19.4)
4D Language Reference ( 4D v19.5)
4D Language Reference ( 4D v19.6)
4D Language Reference ( 4D v19.7)
4D Language Reference ( 4D v19.8)