Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I reverse sort a path and skip the first level?

How do I reverse sort a path and skip the first level?

Ex Path = P1:P2:p3

I want to show P2:P1?

3 Replies
Gysbert_Wassenaar

subfield('P1:P2:p3' , ':' , 2) & ':' & subfield('P1:P2:p3' , ':' , 1)

Or a more general solution:

Reversing:

load MyPath, concat(Element,':',-row) as Reversed Group by MyPath;

load MyPath, iterno() as row, subfield(MyPath,':',IterNo()) As Element

Inline [

MyPath

p1:p2:p3

p4:p5:p6:p7

p8:p9:p10:p11:p12

] While IterNo() <= SubStringCount(MyPath,':');


talk is cheap, supply exceeds demand
Not applicable
Author

Hpw do I just reverse sort the string? is there a function?

Gysbert_Wassenaar

Not as far as I know. You could use this to reverse a string:

Reversing:

load MyText, concat(Letter,'',-row) as Reversed Group by MyText;

load MyText, iterno() as row, mid(MyText,IterNo(),1) As Letter

Inline [

MyText

Testmystring

SecondTest

AnotherString

] While IterNo() <= len(MyText);


talk is cheap, supply exceeds demand