Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Occasionally I have situations where I want to extract all the data from an application. For small applications it is easy enough to create a table and add all the fields as dimensions and “export data” but I have some applications that have over a hundred fields so that becomes tedious. There has to be a better way. Please let me know if you have any alternative recommendations. I appreciate the help!
This tiny 11 line load script that can be put at the end of any Qlik Sense load script will export all fields and all tables to CSV files:
BINARY "$(vSourceQVW)";DataModel=;
FOR t=0 TO NoOfTables()-1
TableName = TableName(t);
vDataModel = vDataModel & Chr(13) & Chr(10) & Repeat('*',80) & Chr(13) & Chr(10) & TableName;
FOR f=1 TO NoOfFields(TableName)
vDataModel = vDataModel & Chr(13) & Chr(10) & '..' & FieldName(f,TableName) ;
NEXT
STORE [$(TableName)] INTO "$(TableName).tsv" (txt,delimiter is \t);
NEXT
t=;f=;TableName=;
You can tweak it into 5 lines if you leave out the data model documentation that is not stored anyway... by deleting lines 2, 5-8.
Or a more well-tested solution which is using the QlikView (and Qlik Sense) Components library:
I was thinking about loading the data to a QVD and then use a tool like EasyMorph | Integration with QViewer to export the data to excel. Any other ideas?
This tiny 11 line load script that can be put at the end of any Qlik Sense load script will export all fields and all tables to CSV files:
BINARY "$(vSourceQVW)";DataModel=;
FOR t=0 TO NoOfTables()-1
TableName = TableName(t);
vDataModel = vDataModel & Chr(13) & Chr(10) & Repeat('*',80) & Chr(13) & Chr(10) & TableName;
FOR f=1 TO NoOfFields(TableName)
vDataModel = vDataModel & Chr(13) & Chr(10) & '..' & FieldName(f,TableName) ;
NEXT
STORE [$(TableName)] INTO "$(TableName).tsv" (txt,delimiter is \t);
NEXT
t=;f=;TableName=;
You can tweak it into 5 lines if you leave out the data model documentation that is not stored anyway... by deleting lines 2, 5-8.
Or a more well-tested solution which is using the QlikView (and Qlik Sense) Components library:
That's very useful. Thanks Petter.
Obsiously it is easy to switch to QVDs instead by changing the STORE... into this:
STORE [$(TableName)] INTO "$(TableName).qvd" (qvd);
Hi petter-s,
Your tiny script is exactly what I was looking for. Awesome solution! Thanks so much for taking the time to share.