Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table that I have to transpose every 10 lines, therefore creating 10 columns. Originally it looks like this:
Value | Index |
121 | 1 |
125 | 1 |
1258412 | 1 |
14852 | 1 |
584125 | 1 |
5846 | 1 |
98953 | 1 |
41265 | 1 |
14862 | 1 |
247862 | 1 |
5896215 | 2 |
5265 | 2 |
652652 | 2 |
6523652 | 2 |
6984255 | 2 |
65264125 | 2 |
36525236 | 2 |
25315230 | 2 |
6841254 | 2 |
14521452 | 2 |
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:
index | column 1 | column 2 | column 3 | column 4 | column 5 | column 6 | column 7 | column 8 | column 9 | column 10 |
1 | 121 | 125 | 1258412 | 14852 | 584125 | 5846 | 98953 | 41265 | 14862 | 247862 |
2 | 5896215 | 5265 | 652652 | 6523652 | 6984255 | 65264125 | 36525236 | 25315230 | 6841254 | 14521452 |
Can someone please, help me write the script?
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
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
Thank you!