Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There
Please find attached cvc file, i want to convert rows into columns.
Is it better to use generic load or cross tab in the attached example.
If we use generic load , how the script will look like?
Thanks,
Here is another approach I like using because it combines the data into a single table at the end of all. You can do this with Generic Load, but it is just an extra step you have to take in order to this...
Table:
LOAD customer_ID,
attribute,
value
FROM
[..\..\Downloads\Customer_Data.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
FinalTable:
LOAD Distinct customer_ID
Resident Table;
FOR i = 1 to FieldValueCount('attribute')
LET vAttribute = FieldValue('attribute', $(i));
Left Join (FinalTable)
LOAD customer_ID,
value as [$(vAttribute)]
Resident Table
Where attribute = '$(vAttribute)';
NEXT
DROP Table Table;
Here is another approach I like using because it combines the data into a single table at the end of all. You can do this with Generic Load, but it is just an extra step you have to take in order to this...
Table:
LOAD customer_ID,
attribute,
value
FROM
[..\..\Downloads\Customer_Data.csv]
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);
FinalTable:
LOAD Distinct customer_ID
Resident Table;
FOR i = 1 to FieldValueCount('attribute')
LET vAttribute = FieldValue('attribute', $(i));
Left Join (FinalTable)
LOAD customer_ID,
value as [$(vAttribute)]
Resident Table
Where attribute = '$(vAttribute)';
NEXT
DROP Table Table;