Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mouni09
Contributor III
Contributor III

Qlik Long to Wide format columns

Hello All, 
I'm working on one scenario In Qlik Cloud where I need to convrt long length quiz_question column to wide length.
10 questions are in one column , here I am trying to show each question as separate column, so that each user have one row only, each question column have an answer as well
I'm using Generic Load here

Generic LOAD
user_id,
Question,
Answer
Resident SurveyFinal;

My problem here is each question is storing in separate table which I don't want, I want to see all questions in same table only and that too wide format only
My store command is like below and we use same store command for all apps 

FOR vCount = 0 to NoOfTables()-1

LET vTableName = TableName($(vCount));

STORE $(vTableName) INTO [$(vSurvey)/$(vTableName).qvd] (qvd);

NEXT vCount

Please help to store all questions in one table only not as multiple tables and not in multiple qvd's storing

1 Solution

Accepted Solutions
adilio_silva
Contributor III
Contributor III

You can combine multiple tables in one:

 

LET vFinalTable = 'MyFinalTable';

FOR vCount = 0 to NoOfTables()-1

LET vTableName = TableName($(vCount));

    $(vFinalTable):
    LOAD *
    RESIDENT $(vTableName)
    ;

NEXT vCount

STORE $(vFinalTable) INTO [$(vSurvey)/$(vFinalTable).qvd] (qvd);
STORE $(vFinalTable) INTO [$(vSurvey)/$(vFinalTable).parquet] (parquet, compression is brotli);

DROP TABLE $(vFinalTable);

View solution in original post

2 Replies
marcus_sommer

The tables could be joined together like it's described here:

The Generic Load - Qlik Community - 1473470

adilio_silva
Contributor III
Contributor III

You can combine multiple tables in one:

 

LET vFinalTable = 'MyFinalTable';

FOR vCount = 0 to NoOfTables()-1

LET vTableName = TableName($(vCount));

    $(vFinalTable):
    LOAD *
    RESIDENT $(vTableName)
    ;

NEXT vCount

STORE $(vFinalTable) INTO [$(vSurvey)/$(vFinalTable).qvd] (qvd);
STORE $(vFinalTable) INTO [$(vSurvey)/$(vFinalTable).parquet] (parquet, compression is brotli);

DROP TABLE $(vFinalTable);