27
Views
4
Comments
Solved
Compare the values with the max and then store in a list
Question

I have a entity like this 


I want to know and store the maximum value of "CountVotes" and then compare this maximum with each number of votes per employee (CountVotePerEmployee) and store in the list all employees who have the same number of votes as the maximum number of votes.

Can someone help me?

Solution

I found a way to solve my problem and I will post it because it might be useful for others.

1. Create a server action with a output variable named MaxVoted 

2. Create a local variable in your screen named "MaxVotes".

3. Create a client action named "MaxVote" like this:

4. Then create in that screen a entity like this:

(the condition allows to only show the last vote from the user, because he can edit his vote)

This entity will store the employee's that have the same number of votes as the maximum number.

Hi Costa,

Please follow these steps:

1. Assign this aggregate in for each loop.

2. Check If condition with max value of each aggregate record with whole list.

3. And append that new list in another list.

If you don't understand share your oml we will check the code and help you.

Thanks

Ruchi

Hello Inês Costa


You can sort ascending by CountVotes, then you can know CountVoteMax

Then loop that list and compare current CountVote with CountVoteMax to store the list.



If you face any problem let me know.

Regards,

Toan

Can you elaborate more please?

Solution

I found a way to solve my problem and I will post it because it might be useful for others.

1. Create a server action with a output variable named MaxVoted 

2. Create a local variable in your screen named "MaxVotes".

3. Create a client action named "MaxVote" like this:

4. Then create in that screen a entity like this:

(the condition allows to only show the last vote from the user, because he can edit his vote)

This entity will store the employee's that have the same number of votes as the maximum number.

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