Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
eduardo_dimperio
Specialist II
Specialist II

Order By with Concat method

Hi,

I'm trying to concat some rows into one, but I need to be order by date and for some reason that's not working.

Input:

image.png

 

Aux_Comentario:
LOAD
DISTINCT 
     ID_INSTALACAO,
     "text" as Texto,
    Date(Date#('19700101', 'YYYYMMDD') + (time / 86400)) AS time
FROM [lib://Dados\Light P&D\cas_br_cuc\Analise\Google\Place\PlaceStatus.qvd](qvd)
WHERE LEN(text)>0
;

NoConcatenate Aux_Comentario2:
load *, AutoNumber(ID_INSTALACAO&time,ID_INSTALACAO) as key Resident Aux_Comentario
order by ID_INSTALACAO,time DESC;

DROP TABLE Aux_Comentario;

NoConcatenate
Comentario:
load
ID_INSTALACAO,
Concat(time&': '&Texto,Chr(10)) as Texto_Concat
Resident
Aux_Comentario2
WHERE key<=3 and len(Texto)>0
Group by ID_INSTALACAO
order by key DESC
;

DROP TABLE Aux_Comentario2;

 

 

output:

image.png

 

 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

I think you need to enable the sorting within the concat() which could be done within the third parameter, maybe with something like this:

...
Concat(time&': '&Texto,Chr(10), -key) as Texto_Concat
...

- Marcus

View solution in original post

2 Replies
marcus_sommer

I think you need to enable the sorting within the concat() which could be done within the third parameter, maybe with something like this:

...
Concat(time&': '&Texto,Chr(10), -key) as Texto_Concat
...

- Marcus

eduardo_dimperio
Specialist II
Specialist II
Author

Great!!! 

That work perfectly, I didn't notice about this 3 parameter. - Concat ([ distinct ] string [, delimiter [, sort-weight]])

 

Thank you