1 (edited by thezimguy 2018-08-27 08:51:28)

Topic: [SOLVED] Ranking Columns in database

Hello Dmitry and MVD users,
Please is there a function for getting the ranks of values in a column of a table in a database in MVD or a workaround?
https://s6.postimg.cc/pqqoojvlt/ranking_Column.png

I used the following in excel

=RANK(B2,B$2:B$8,0)

Regards

@thezimguy

2 (edited by derek 2018-08-25 19:29:24)

Re: [SOLVED] Ranking Columns in database

Hello There,
I don't know of any 'rank' function but you can do it by script (please see the attached - lines 35-50).
There may be other / better ways but it seems to work.
Hope this helps,
Regards,
Derek.

Post's attachments

Attachment icon ranking.zip 365.17 kb, 476 downloads since 2018-08-25 

Re: [SOLVED] Ranking Columns in database

Thank you Derek,
I will try it and let you know the outcome

@thezimguy

4 (edited by thezimguy 2018-08-27 08:46:05)

Re: [SOLVED] Ranking Columns in database

Wow Derek
This is great
It works perfectly
I will find a way to add it to the column in the database
Thanks

@thezimguy

Re: [SOLVED] Ranking Columns in database

Hello Derek,
Please I am having problems with scores which are more than or equal to 10 (score>=10).
It does not rank these scores. Instead of those scores coming up to the first position they tend to be at the last positions

Example

Score:Rank
8:1
7:2
6:3
6:3
6:3
5:6
5:6
4:8
10:9

Thanks

@thezimguy

6 (edited by thezimguy 2018-08-27 09:19:59)

Re: [SOLVED] Ranking Columns in database

thezimguy wrote:

Hello Derek,
Please I am having problems with scores which are more than or equal to 10 (score>=10).
It does not rank these scores. Instead of those scores coming up to the first position they tend to be at the last positions

Example

Score:Rank
8:1
7:2
6:3
6:3
6:3
5:6
5:6
4:8
10:9

Thanks

I have figured it out.
The problem was with the data type in the database. The type was text so I changed it to real for the code to treat the scores as numbers and not text.
Thank you Derek

@thezimguy

Re: [SOLVED] Ranking Columns in database

Hi There,
Sorry about that - I was trying a couple of things (adding an '=' sign or changing colour when the score is the same - but it may be overkill for what you want) and forgot to reset the data types (see attached).
Regards,
Derek.

Post's attachments

Attachment icon ranking equals and colour.zip 365.65 kb, 512 downloads since 2018-08-27 

Re: [SOLVED] Ranking Columns in database

derek wrote:

Hi There,
Sorry about that - I was trying a couple of things (adding an '=' sign or changing colour when the score is the same - but it may be overkill for what you want) and forgot to reset the data types (see attached).
Regards,
Derek.

You are great Derek
I appreciate your kindness

@thezimguy

Re: [SOLVED] Ranking Columns in database

Thank You, Thank You