Retrieving the list of unique data elements is always helpful when manipulating data. In some cases, retrieving the number of occurrences of each value is essential. The distinct function of the Collection and Entity selection classes allows retrieving a list of unique values. With 4D v20, you can also retrieve the number of occurrences of each distinct value.
And that’s not all!
An object in the database can be used to save custom data entered by the user. So on the code side, you need to know all the possible paths to the object. The distinctPaths function has been added to the Entity selection class.
Here is everything you need to know.
4D v16 R6 opens a wide range of possibilities to manage collections. Merging two collections into one, cloning or just ordering a collection is as easy as calling a method. It saves valuable time, for example, when you need to concatenate two collections, keep only the distinct values, or sort it.
With 4D v15 R4, a new parameter is introduced for the DISTINCT VALUE command. This parameter must be an array, and it receives the count of each distinct value in a selection of records.
This feature is particularly useful for obtaining statistics on records, or to order records by their most common type.