Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using only function with ranking to create sort order navigation

Hello community,

I am displaying one image at a time in my app but I'm struggling to get the sorting order right.

catsubcat.PNG.png

I've created a demo app you can try out.

In the screenshot you can see that I have CategoryID, SubcatID, CategoryIndex (SQL Row_number() Over (Partition By CategoryID)) and an ImgFileSource field ( '..\files\' & SubcatID & '.gif' AS ImgFileSource).

The sorting should be as follows: CategoryID Desc + highest Index at rank = 1

So looking at the screenshot above it should be C0007, C0006, C0005(3), C0005(2), and so on.

To display the image in this order I tried without luck:

=only({<CategoryID={'=rank(CategoryID)=$(vRank)'}>}ImgFileSource)

For the "NEXT RANK" action I used:

=if($(vRank)<max(aggr(rank(CategoryID),SubcatID)),$(vRank)+1,$(vRank)) 

I've just added the CategoryIndex field but I don't know if I actually need it for my task.

Hopefully you can show me how to put this in order.

Thank you,

Thorsten

1 Solution

Accepted Solutions
Carlos_Reyes
Partner - Specialist
Partner - Specialist

I think it's easier to create a consecutive number in the script. Then you can use that number to move back and forward to the specific image. Please see the attached file to see (I just created the serial, didn't change the text objects)

View solution in original post

4 Replies
Carlos_Reyes
Partner - Specialist
Partner - Specialist

I think it's easier to create a consecutive number in the script. Then you can use that number to move back and forward to the specific image. Please see the attached file to see (I just created the serial, didn't change the text objects)

jonasheisterkam
Partner - Creator III
Partner - Creator III

Hi,

i have a small code wich can be add to a action, to select the next alternative value of a field. If the last value is reached it will go to the first. With a little math you can create previous button, at the moment i am not able to get the ready code to copy it. If you need it i can copy it tomorrow.

Concat can be sort if the sortfield is numeric.

subfield(concat(distinct{<Feld=>} Feld,'|'),'|',

mod(substringcount(left(concat(distinct{< Feld =>} Feld,'|'),index(concat(distinct

{< Feld =>} Feld,'|'),Feld)),'|')+1,count(distinct {< Feld =>} Feld))+1)


Not applicable
Author

thank you for showing this way - I should be able to get it working from here.

Not applicable
Author

thanks for your code sample but I think I'll go the easier way here 🙂