Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ashishpalkar
Creator III
Creator III

How to use generic load / cross tab

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,

1 Solution

Accepted Solutions
sunny_talwar

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;

Capture.PNG

View solution in original post

2 Replies
tresesco
MVP
MVP

You would need a Generic Load

Simply try:

Generic LOAD * From <>;

sunny_talwar

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;

Capture.PNG