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: 
sunny_talwar

Load order in Concat() function

Hi Guys -

While helping someone on the community (First Function() in a table graph), I stumbled across a scenario where I wanted to use Concat() function and wanted to sort is by load order. I know this can be done easily by adding a RecNo() or RowNo() in the script. But the idea is if I don't want to make changes in the script, is it still possible?

I thought of using Aggr() function, as Stefan (swuehl‌‌) once mentioned in a post that Aggr() function usually sorts by load order. But that doesn't seem to be true in this particular case. Have a look at the attached sample:

Sample Data:

Table:

LOAD * Inline [

Dim1, Val1, Val2

a, ak3, 1

a, ak1, 4

a, ak5, 2

b, ak4, 5

b, ak2, 2

];

I tried these expressions:

=Concat(DISTINCT Val1, ', ')

=Concat(DISTINCT Val2, ', ')

=Aggr(Concat(DISTINCT Val1, ', '), Dim1)

=Aggr(Concat(DISTINCT Val2, ', '), Dim1)

The order for Expression1 and 3 I am getting is this -> ak1, ak3, ak5 and I am looking for -> ak3, ak1, ak5 when Dim1 = a

Capture.PNG

Best,

Sunny

1 Solution

Accepted Solutions
sunny_talwar
Author

I think I found the solution to my problem:

=Concat(DISTINCT Val1, ', ', Aggr(RowNo(), Dim1, Val1))

Capture.PNG

View solution in original post

1 Reply
sunny_talwar
Author

I think I found the solution to my problem:

=Concat(DISTINCT Val1, ', ', Aggr(RowNo(), Dim1, Val1))

Capture.PNG