Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
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: 
Jeevayswaran
Contributor III
Contributor III

Sort the numbers in ascending order in a variable

Hi All,

 

I have a variable with list of values concatenated.

vNum= 5,7,8,9,2,3,1

 

I need to sort them and store in an another variable. How to do?

Expected result: 1,2,3,5,7,8,9

Labels (3)
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this

=concat( mid(vNum, ValueLoop(1, len(vNum)),1),'',mid(vNum, ValueLoop(1, len(vNum)),1))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

5 Replies
edwin
Master II
Master II

presummably, you are concatenating the values of some field (this is Qlik after all), you can specify the sort order in the concat function:

https://help.qlik.com/en-US/qlikview/May2023/Subsystems/Client/Content/QV_QlikView/ChartFunctions/St....

edwin_0-1702921294334.png

 

Anil_Babu_Samineni

Perhaps this

=concat( mid(vNum, ValueLoop(1, len(vNum)),1),'',mid(vNum, ValueLoop(1, len(vNum)),1))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Jeevayswaran
Contributor III
Contributor III
Author

How this will work if i have 2 digit numbers? please share me the expression.

Jeevayswaran
Contributor III
Contributor III
Author

Hi Anil Babu,

I used your concept and used the subfield function to split the values. It worked for me to order more than 1 digit numbers. Thanks a lot.

Jeevayswaran
Contributor III
Contributor III
Author

Hi Edwin,

Thanks for your reply. When I used the sort weight option, The concatenate result has duplicate values .(Sometime the same bucket appears 2 times)