Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QlikWorld happening right now! You can still join: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
yanivbm88
Creator
Creator

Export table to .csv using STORE command in script

Hi,

My goal is to export a full table to .csv file. In addition, I want to add a delimiter which I determine.

I understood the best/easiest way to do so in Qlik Sense is by using STORE command in the script. No need for VBA macros.

Does anybody have suggestions for the exact syntax?

Thanks!

21 Replies
yanivbm88
Creator
Creator
Author

hi Avinash,

See below, I make a couple of JOINs between QVDs. The last line is where I try to export to CSV, I tried some versions of it (including calling it from 'lib' and Govind suggestions from above)

DimKanban:

LOAD

    City,

    Country as CountryCode,

    KanbanCode,

    KanbanName,

    State as StateCode,

    SubcontractorCode,

    SupplierCode

FROM [lib://Global Data DB_Source (win-n5h9rv84sq3_administrator)/Kanban.qvd] (qvd);

Left Join

LOAD

    Continent,

    CountryCode,

    CountryName,

    EuropeanRegion,

    Region,

    "TimeZone" as CountryTimeZone

FROM [lib://Global Data DB_Source (win-n5h9rv84sq3_administrator)/Country.qvd]

(qvd);

Left Join

LOAD

    StateCode,

    StateName,

    "TimeZone" as StateTimeZone

FROM [lib://Global Data DB_Source (win-n5h9rv84sq3_administrator)/State.qvd] (qvd);

Left Join

LOAD

    SupplierCode,

    SupplierName,

    SupplierType

FROM [lib://Global Data DB_Source (win-n5h9rv84sq3_administrator)/Suppliers.qvd] (qvd);

left join

LOAD

    SubcontractorCode,

    SubcontractorName

FROM [lib://Global Data DB_Source (win-n5h9rv84sq3_administrator)/Subcontractor.qvd]

(qvd);

left join

LOAD

    Code as KanbanCode,

    PlantTo as Plant,

    SlocTo as Sloc

FROM [lib://Microsemi EDI_DB (win-n5h9rv84sq3_administrator)/PlantKanban.qvd]

(qvd);

Store * From DimKanban into [lib://Microsemi EDI_Schema (win-n5h9rv84sq3_administrator)/DimKanban_Temp1.qvd];

Store DimKanban into testcsv.csv(txt);

yanivbm88
Creator
Creator
Author

Hi Justin,

Yes, I did and got the same error. Also tried to create a data connection and use 'lib' with no success (See my response to Avinash).

yanivbm88
Creator
Creator
Author

Does anybody have a further feedback?

thevingo
Creator
Creator

May be some experts help

tresesco

kavita25

swuehl

jagan

ahmar811

avinashelite

I tried with the sample data its working fine for me , not sure what's going in your script ...could you share the sample qvd/ QVF files let me check and get back to you

HarishG
Partner
Partner

Try this, might help..

Store DimKanban into 'lib://Microsemi EDI_Schema (win-n5h9rv84sq3_administrator)/testcsv.csv(txt)';

yanivbm88
Creator
Creator
Author

Hi Harish,

Thanks for your reply,

I still get the csv file in the same strange format which I uploaded in my response to Avinash,

yanivbm88
Creator
Creator
Author

Hi Avinash,

Sure, Attached is a zip file with the following:

  • Qvd of the table I try to export to CSV
  • The app file, which I created in QS server
HarishG
Partner
Partner

Those attached files contains the xml format of your data. If you wish try out storing in xls or xlsx to check, then you can try the below,

Store DimKanban into 'lib://Microsemi EDI_Schema (win-n5h9rv84sq3_administrator)/testcsv.xls(txt)';

HarishG
Partner
Partner

The issue occurs in your Data connection 'lib://Microsemi EDI_Schema (win-n5h9rv84sq3_administrator).


When you are using single quotes (' ') in the store command for your path, the sense is storing the data in xml, in order to exclude ' ' , avoid the spaces in between the data connections folder or make sure you avoid (win-n5h9rv84sq3_administrator) in the folder data connection name. it will work.

For eg, you Script and Store should command should be as shown below :


DimKanban:

LOAD

    KanbanCode,

    SubcontractorCode,

    SupplierCode,

    StateCode,

    CountryCode,

    City,

    KanbanName,

    VendorCode,

    IsKanbanBlocked,

    Continent,

    CountryName,

    EuropeanRegion,

    Region,

    CountryTimeZone,

    StateName,

    StateTimeZone,

    SupplierName,

    SupplierType,

    SubcontractorName,

    Plant,

    Sloc

FROM [lib://ServerLogFolder/DimKanban_Temp1.qvd]

(qvd);

Store DimKanban into lib://ServerLogFolder/testcsv12.csv (TXT);


And also i have attached the output csv file from this store command.