104
Views
6
Comments
Solved
List Distinct - work on Objects?
Question
Application Type
Reactive

It should be simple, but I am not finding solution anywhere.

On the main screen of my app, I have a table of, let's call them "Objects". These objects have many attributes.

Within the app and in this first table, multiple rows (multiple "Objects") can be selected (for processing), but before processing them I need to (in a pop-up) load a new table with the selected "Objects" from before and perform a distinct operation on a specific attribute of these selected objects (not the ID, but another attribute).

How would you solve this? I cannot do a "Group By" in the new table of "selected Objects", so I am not figuring out how to solve this.

Thanks!

2019-01-07 16-04-16
Siya
 
MVP
Solution

Your logic will work. However you need only one loop for List A and use ListIndex for searching the List B inside the loop.

2019-01-07 16-04-16
Siya
 
MVP

The 'ListDistinct' action is not a solution for your problem. You will need to implement an algorithm yourself to obtain distinct objects based on specific attribute(s).

UserImage.jpg
Andrés Besio

You mean a "Server action" that eliminates duplicates?

2019-01-07 16-04-16
Siya
 
MVP

You can implement the logic client-side since the data is already displayed on the screen.

UserImage.jpg
Andrés Besio

Would you help me solve this logic?

My idea is to have in memory both list:

List A: List in which the user select the "Objects"

List B: List with distinct values of a specific attribute from List A.

That client action must have an input and output parameter, where List A is the input and List B the output. The function would iterate through list A and check if that attribute is already in list B. That is, there are two nested ForEach loops. Am I thinking this through correctly? 

2019-01-07 16-04-16
Siya
 
MVP
Solution

Your logic will work. However you need only one loop for List A and use ListIndex for searching the List B inside the loop.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.