how to generate rank

Highlighted
Eight 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


Accepted Solutions
Community Manager

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. 

 


All Replies
Fifteen Stars TRF
Fifteen 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
Community Manager

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. 

Eight 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



Community Manager

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. 

 

Eight 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

Four Stars

Re: how to generate rank

But I want to know how to use dense rank in this condition.if highest Marks having 3rows and lowest marks also 3 rows then how to find out dt one
Community Manager

Re: how to generate rank

@Talend65 can you raise a new question since it is not the same as the one here and it can get confusing for people searching for solutions when questions evolve.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog