Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Asuod_
Contributor III
Contributor III

Ranking in script with Partial Reload

Hello,

I am trying to ReRank the userRanking using the column userRank_1 via partial load. Right now the script below ranks the following. Looking for any assistance, i tried the order by but it doesnt seem to work when im using the partial load. Thank you in Advance.

Current:

userRank userRank_1
2 2
3 3
4 4
5 1

 

Goal:

userRank userRank_1
2 1
3 2
4 3
5 4

 

Script:

IF IsPartialReload() THEN

 drop Table Dependency;

Dependency:

    Replace only

 LOAD

    If(Len(userRank)<1, userRank, RowNo()) as userRank_1,

    userRank,

    Total_Score,

    id,

FROM [lib://Table.qvd]

(qvd);

    Store Dependency into [lib://Tablel.qvd](qvd);

ENDIF;

Asuod__0-1694733763530.png

2 Replies
anat
Master
Master

i think you need to sort the data to get proper ranks.

load userrank,RowNo()as userRank_1

resident table order by userrank ;

Asuod_
Contributor III
Contributor III
Author

Hi Anat, 

I tried sorting and using the RowNo() but it doesnt seem to sort correctly in the QVD. Essentially what i want to do is in a partial load, re-sort the ranking then provide a new ranking based on the sort and save it back into the QVD but it keeps coming out incorrect. 

Andrew