Six Stars

how to generate rank

Hi

I have one task to generate rank for students based on their total marks

am able to generate rank for the students who are having high score as 1 and other 2 ....so on

 

but here my problem is if two or more student is having same total marks then i need to compare their subject wise marks and if subject wise are same then i need to compare other subject like so on

Appreciate for your help

Regards

rekha

Tags (3)
1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars

Re: how to generate rank

OK, scrap what I said previously, there is a much easier way of doing this. Just use the tSortRow component and set the Criteria according to your rank priority (top to bottom). Then you will know that the first row out of this will be your top ranked individual, the last will be your bottom ranked. Use a tMap with a sequence to assign the rank. 

 

Rilhia Solutions
5 REPLIES
Twelve Stars TRF
Twelve Stars

Re: how to generate rank

Hi,

 

OK, the usecase is clear but can you give us a sample for input record and the corresponding expected result?


TRF
Twelve Stars

Re: how to generate rank

OK, this is more of an algorithm problem, than a Talend problem. Essentially you have several levels whereby a rank can be derived. As you have described, you start with one piece of data, but where that is the same you go down to a different level, where that is also the same, you go to another level. Why not start your ranking algorithm at the most granular level for everyone? Come up with a standardisation rule for your different ranking levels (between 1 to 10 or 1 to 1, etc) and then it should be relatively simple maths with a tSort component. 

Rilhia Solutions
Six Stars

Re: how to generate rank

Yes,
input

Rollno maths science social. total
101. 99. 72. 89. 260
102. 89. 72. 99. 260
103. 99. 74. 90 263


Output

101. 2nd rank(as highest marks in maths when compared with 102 maths
marks .)
102. 3rdrank
103. 1sr rank


If maths marks equal then start comparing science ...so on



Twelve Stars

Re: how to generate rank

OK, scrap what I said previously, there is a much easier way of doing this. Just use the tSortRow component and set the Criteria according to your rank priority (top to bottom). Then you will know that the first row out of this will be your top ranked individual, the last will be your bottom ranked. Use a tMap with a sequence to assign the rank. 

 

Rilhia Solutions
Six Stars

Re: how to generate rank

Hi rhall,

 

Thank you so much for this simple solution am trying a lot.now i understand where i did mistake.and i got output also

 

Thanks a lot.

Smiley Happy

 

Regards

bhagyarekha