Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ggerotto
Contributor II
Contributor II

Creating multiple columns with CrossTable

I have a table that I have to transpose every 10 lines, therefore creating 10 columns. Originally it looks like this:

ValueIndex
1211
1251
12584121
148521
5841251
58461
989531
412651
148621
2478621
58962152
52652
6526522
65236522
69842552
652641252
365252362
253152302
68412542
145214522

 

The index represents the number of the line. As you can see there are only two columns in the table. I tried to create a CrossTable function but I do not understand how to do it and specify that there should be 10 new columns.

The final result should look like this: 

indexcolumn 1column 2column 3column 4column 5column 6column 7column 8column 9column 10
11211251258412148525841255846989534126514862247862
25896215526565265265236526984255652641253652523625315230684125414521452

 

Can someone please, help me write the script? 

Labels (5)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It's actually a Generic Load problem, not a CrossTable Load. This script will do the trick with your sample data.

Data:
Generic
LOAD
  Index,
  'Column ' &
AutoNumber(RecNo(), Index),
  Value      
FROM
[https://community.qlik.com/t5/QlikView-Scripting/Creating-multiple-columns-with-CrossTable/td-p/1756...]
(
html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

See: https://qlikviewcookbook.com/2010/05/use-cases-for-generic-load/

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It's actually a Generic Load problem, not a CrossTable Load. This script will do the trick with your sample data.

Data:
Generic
LOAD
  Index,
  'Column ' &
AutoNumber(RecNo(), Index),
  Value      
FROM
[https://community.qlik.com/t5/QlikView-Scripting/Creating-multiple-columns-with-CrossTable/td-p/1756...]
(
html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

See: https://qlikviewcookbook.com/2010/05/use-cases-for-generic-load/

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

ggerotto
Contributor II
Contributor II
Author

Thank you!