Add attribute selection in list distinct
243
Views
1
Comments
New
Builtin & User functions

Hi Team,


It will be better if we can add an option for attribute selection in list distinct.

For example: - 

Thanks & Regards,

Ramesh Sirvi

Hi Ramesh,


That's probably not what ListDistinct is intended for, the only thing it does is remove full duplicates, the whole thing (all attributes) being equal.  

If you would want to be able to specify to only take into consideration some of the attributes to determine equality, that would make things much more complex : what would have to happen with all the other attributes in the result set ?  Leave them empty ?  Apply a function like max or average ??  

I'm not saying this could not be a usefull function to have, just that that is not what this simple ListDistinct function is for.  Also, only really necessary if you don't have the data available in a database, where you can just write the right aggregate/query.

As an alternative, you can make another list with only the attributes you want to apply distinct on.  Let's say you have employees, and you want a distinct list of the cities (and for some reason, you can't or don't want to use an aggregate or sql to do this ??), then you could make a list of cities, assign that from the employee list with mapping of the city, and then apply ListDistinct on that second list.


Dorine