How to get distinct records in a record list?
For example, after adding multiple search results to a list, I want the list to have unique records.
Use the component SortRecordList from the OutSystems Forge. However, the component requires Lists of Records instead of Entity Lists.
The example below declares two variables of type List of Record, CustomersWithRepeatedValues and CustomersDistinct.
Note that the Data Type is Customer Record List, and not Customer List.
Call the action DistinctRecordList to generate the list of distinct records:
- The parameter compareBy which attribute to check for uniqueness. In the example, Customer.Id.
- The parameters recordList and outputList receive a generic object. Use the ToObject function to wrap the lists.