I have more than 300 rows in an entity having a year column, that column having the same value like 2020 will be repeated n number of times.
I am required to do the Grouping of the same value and show them one time only instead of showing the same values multiple times. How that can be done?
It’s not working, for test purpose, I have created a source and for that, I can get the distinct values.
Not Getting Distinct:- Fetch(of PraticeEntity)(Nothing, Nothing, Nothing, Nothing, New ExpansionFieldOption(){addExpansionFieldOption("CreatedBy", New String(){"Id","Name"}), addExpansionFieldOption("UpdatedBy", New String(){"Id","Name"})}).data.GroupBy(Function(x) x.Year).Select(Function(group) group.First()).ToListSource()
Putting the column name as Year in the Column field as the values are coming from an entity
let us not mismatch GroupBy and Distinct
For Distinct we also suggested the DistinctBy as there would no Custom Comparer in Place for the used Entity Type
It looks to us that your case can be reformulated to:
Prefetch1 - the normal DS Fetch
DistinctYearList: Prefetch1.data.Select(Function (x) x.Col2).Distinct().OrderBy(Function(s) CInt(s)).ToArray
Demonstrating Control we reordered