Discussion Board for collaboration on QlikView Scripting.
I'm trying to learn the structure of coding in the script environment. So i'm trying to implement crosstable functionality without using the crosstable function.
Has anyone got an ideas as to how I should go about this.
Initial Data layout would be like so
Resultant Data Layout
Any help would be greatly appreciated.
Go to Solution.
Try this script:
1. If you want to user CrossTable
LOAD * Inline [
Year, ProdID, Test1, Test2, Test3
2003, A, 45, 12, 92
2004, B, 62, 78, 11
2005, A, 76, 89, 64];
Year AS Years,
RENAME Field [Year] to [Value1];
DROP Table [Data];
2. If you don't want to use Cross Table
Year AS NewYear,
ProdID AS NewProdID,
'Test1' AS Fields,
Test1 AS Value
'Test2' AS Fields,
Test2 AS Value
'Test3' AS Fields,
Test3 AS Value
For me I prefer Cross Table than second solution.
Your Initial data and result the same..
Maybe a mistake?
Here's what I did:
Initial:LOAD * INLINE [ Year, ProdID, Test1, Test2, Test3 2003, A, 45, 12, 92 2004, B, 62, 78, 11 2005, A, 76, 89, 64];
Result:Load Year, ProdID, 'Test1' as TestCase, Test1 as ResultResident Initial;
concatenateLoad Year, ProdID, 'Test2' as TestCase, Test2 as ResultResident Initial;
concatenateLoad Year, ProdID, 'Test3' as TestCase, Test3 as ResultResident Initial;
drop table Initial;
I'm more interested in creating the crosstable function (and i didn't explicitly state this) but you've both answered my question.
Thanks very much.