Skip to main content
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: 
HWallays
Contributor III
Contributor III

Reversed Cross table possible ?

Is there a possibility to do some type of reverse Cross table function , whereby information that is stored on a line base , get converted to a column base ( in the data import process) . Reason I need to assemble multiple lines (for instance processes ) for 1 Company into 1 line , whereby the number of lines and sequence of the values in the process is randomn per Company 

 

For instance (simplified version ) , I havc a file with 

Company 1  Process A

Company 1 Process D

Company 2 Process A

Company 2 Process C

Company 3 Process D 

And I would like to end up with having the processes preferably as concatenated values (see below) or if not feasible in seperate columns ...

Company 1 , Process A - Process D

Company 2 , Process A - Process C   

Company 3 , Process D

 

 

 

Labels (2)
4 Replies
qlikster
Contributor III
Contributor III

PrashantSangle

Try below

Test:
Load Company,Concat(Process,'-') as NewProcess group by Company;
Load * Inline [
Company, Process
Company 1,Process A
Company 1,Process D
Company 2,Process A
Company 2,Process C
Company 3,Process D
];

 

Regards,

Prashant Sangle

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Rohan
Specialist
Specialist

Hi @HWallays ,

You can try something like the following script & expand on it as per your data model :

T:
Load * Inline [
Company, Process
Company 1,Process A
Company 1,Process D
Company 2,Process A
Company 2,Process C
Company 3,Process D
];


Temp :
Load
Concat(distinct chr(39)&Process&chr(39),',') as Plist
Resident T;

let vPList=peek('Plist',0,'Temp');

Drop table Temp;

New:
Load Distinct
Company
Resident T;

for each i in $(vPList)

left join(New)
Load
Company,
1 as [$(i)]
Resident T where Process='$(i)';

next i;

Drop table T;
exit Script;

Find the below output : 

Rohan_0-1719312716031.png

 

Let me know if it worked for you.

 

Regards,

Rohan.

 

 

 

HWallays
Contributor III
Contributor III
Author

THanks for your replies guys, you made my day. Indeed I was able to fix this via the concat command ( which was new to me ). An easy solution for a blocking issue 😉