Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
haymarketpaul
Creator III
Creator III

Concatenate to Pipe Delimited Fields and Maintain Order

QV12 SR 4

Hoping someone can point me in the right direction.

I need to concatenate some answers into a single row whereby some fields will be pipe delimited but i need to maintain a certain order in the pipe delimited fields.

Best explained with an example i think.  Let's say i have this data.  NB  Customer # is always unique per user all others may not be

UserIDBPNCustomer #Sub Date
123100888400123

11/07/2013

12310059940045608/07/2014
12310063740078911/07/2013
12310055240032122/06/2016
12310055240065408/07/2014
12310079240098727/10/2016
12310059940015903/06/2015

So i need to end up with one row per user - so the BPN, Customer # and Sub Date fields would be pipe delimited as follows

UserIDBPNCustomer #Sub Date
123100888|100599|100637|100552|100552|100792|100599400123|400456|400789|400321|400654|400987|40015911/07/2013|08/07/2014|11/07/2013|22/06/2016|08/07/2014|27/10/2016|03/06/2015

So in the above result the first pipe in each field corresponds to the first row from the top table and the second pipe corresponds to the second row and so on for however many rows per user.

It doesn't matter by which column(s) the top table is initially ordered.

Thought i might be able to use Concat with a weighted sort but haven't managed to crack it yet and may be over thinking the issue!?

Hope that makes sense - any ideas greatly welcomed

11 Replies
haymarketpaul
Creator III
Creator III
Author

yep clever by name clever by nature

Clever_Anjos
Employee
Employee