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

sorting not working on concatinating numeric value

Hi,

I have a total field with values ranges from 1 to 100.

It displays fine in ascending order in listbox but when I try to concat the values in a variable, sorting is not working.

Example, I have values like

0

1

2

4

23

25

42

65

100

when im concatinating these values using concat(distinct total,'/')

im Getting the follwing

0 / 1 /100 / 2 /23 /25 /42 / 65

but I want

0 / 1 / 2 /4 /23 /25 /42/65/100

Am I missing Something?

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Try this

concat( No,'/',No)

View solution in original post

5 Replies
anbu1984
Master III
Master III

Try this

concat( No,'/',No)

senpradip007
Specialist III
Specialist III

If you want to it in script try like this

A:

LOAD * Inline [
AA
0
1
2
4
23
25
42
65
100
];


B:
NoConcatenate
LOAD
AA,
If(RowNo()=1, AA, Peek('BB',-1)&'/'&AA) AS BB
Resident A;

DROP Table A; 

Not applicable
Author

Hi Anbu,

Thank You so much...

Its Working Great!!!!

I want to know like what  the third parameter actually does?

anbu1984
Master III
Master III

Third parameter is sort-weight.


From QV help

concat ([ distinct ] expression [, delimiter [, sort-weight]])

Returns the aggregated string concatenation of all values of expression iterated over a number of records as defined by a group by clause. Each value may be separated by the string found in delimiter. The order of concatenation may be determined by sort-weight. Sort-weight should return a numeric value where the lowest value will render the item to be sorted first. If the word distinct occurs before the expression, all duplicates will be disregarded.

Not applicable
Author

Thanks again!

Sent from Samsung Mobile