What is the best way to list unique values from a datasource?
E.g. I want to list all contractlines with a specific value, and I want to group them per contract header. So one contract header can have many lines. Some contract header might not have lines with the specific value and other contracts maybe have several lines with the specific value.
Hi! You can list your values by using two repeating containers. In the first container you iterate your contracts data source, and in the second the contract lines data source. You can “connect” these two containers by using a filter on the second container, which displays all contract lines which correspond the contract in the header. You can also find an example in the Showroom (but there only one iterating container is used).
Thanks for your answer. So there is no other way then looping through all records to find the unique values?
There is no function similar to a SQL SELECT DISTINCT Statement?
You might extract these values from inside the function editor. In other words, extracting distinct values from an array of objects (array of objects = an Appfarm data source with cardinality “many”, added as a function parameter). However, outside the function editor, we have no generic “array” concept, only Object Classes in the Global Data Model. This is on the roadmap however (having e.g. a property/variable that is an array).