Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
neerajthakur
Creator III
Creator III

Sorting Data in Concat

I want to sort data in decreasing order by year and display the result in concat.

I have tried using sort weight but it didn't work.

I have following data:

Year: 1992,2008

SchoolName,: XYZ,ABC

Desc: 123,456 

respectively 

concat(Year&' | '&SchoolName&' | '&Desc,chr(13)) as Education

 

results I want:

2008 | XYZ | 123

1992 | ABC | 456

 

Please guide on how to achieve this.

I have also tried sorting data before in temporary table

 

 

Thanks & Regards,
Please Accepts as Solution if it solves your query.
1 Solution

Accepted Solutions
MarcoWedel

Hi,

did you try to with negative Year as sort weight to get a decreasing sort order?:

QlikCommunity_Thread_t5_QlikView-App-Dev_Sorting-Data-in-Concat_m-p_1851653_Pic1.PNG

table1:
LOAD ID,
     Concat(Year&' | '&SchoolName&' | '&Desc, Chr(13), -Year) as Education 
Inline [
    ID, Year, SchoolName, Desc
    1, 1992, XYZ, 123
    1, 2008, ABC, 456
    2, 1993, WXY, 234
    2, 2007, BCD, 567
    2, 2001, CDE, 678
]
Group By ID;

 

hope this helps

Marco

 

 

 

View solution in original post

4 Replies
ManuelRühl
Partner - Specialist
Partner - Specialist

How do you want to display it?

like this?

 

mruehl_0-1635231508016.png

 

LOAD *, YEAR&'|'&SCHOOLNAME&'|'&DESC as CONCAT;
LOAD * INLINE [
YEAR, SCHOOLNAME, DESC
1992, XYZ, 123
2008, ABC, 456

];

Manuel Rühl
neerajthakur
Creator III
Creator III
Author

2008|ABC|456 should be at top and then 1992|XYZ|123

Thanks & Regards,
Please Accepts as Solution if it solves your query.
ManuelRühl
Partner - Specialist
Partner - Specialist

So you can just sort it within the list box.

Manuel Rühl
MarcoWedel

Hi,

did you try to with negative Year as sort weight to get a decreasing sort order?:

QlikCommunity_Thread_t5_QlikView-App-Dev_Sorting-Data-in-Concat_m-p_1851653_Pic1.PNG

table1:
LOAD ID,
     Concat(Year&' | '&SchoolName&' | '&Desc, Chr(13), -Year) as Education 
Inline [
    ID, Year, SchoolName, Desc
    1, 1992, XYZ, 123
    1, 2008, ABC, 456
    2, 1993, WXY, 234
    2, 2007, BCD, 567
    2, 2001, CDE, 678
]
Group By ID;

 

hope this helps

Marco