Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pavanthota
Creator
Creator

Export a Table box in txt file

Hi,

i have one table box in sheet i want to export that into .txt file with comma delimeted by using script . Can any one help .

9 Replies
Miguel_Angel_Baeyens

Hi,

As long as a table box is usually a table, because it has no aggregations, you can do that using the same STORE sentence you use for QVD:

STORE Table AS TextFile.txt (txt);

Hope that helps.

Miguel

pavanthota
Creator
Creator
Author

Hi Miguel

Thanks for your quick reply do i  need to give table object in the place of "Table" in code

Thanks,

Pavan

Miguel_Angel_Baeyens

Hi Pavan,

That's not possible. In load time, when the script is executed, the objects are not populated yet, so it's not possible to call them within the script. You can use a macro to export the object using a button or something like that, but always in run time, not in load time.

Anyway, create in the script a table with the same fields you are going to populate that table box, then store it as mentioned above. That will do.

Hope that helps.

Miguel

pavanthota
Creator
Creator
Author

HI Miguel ,

I tried to   create in the script a table with the Final  fields   and then stored in to .txt file with comma delimeted but its taking UTF format i want that table as ANSI format

Thanks

Pavan

Not applicable

According to the below its UTF or nowt: - (from Qlikview help)

A QVD or a CSV file can be created by a store statement in the script. The statement will create an explicitly named QVD or CSV file. The statement can only export fields from one logical table. The text values are exported to the CSV file in UTF-8 format. A delimiter can be specified, see Load. The store statement to a CSV file does not support BIFF export.

store[ *fieldlist from] table into filename [ format-spec ];

*fieldlist::= ( * | field ) { , field } ) is a list of the fields to be selected. Using * as field list indicates all fields.

field::= fieldname [as aliasname ]

fieldname is a text that is identical to a field name in the table. (Note that the field name must be enclosed by straight double Quotation Marks or square brackets if it contains e.g. spaces.)

aliasname is an alternate name for the field to be used in the resulting QVD or CSV file.

table is a script labeled, already loaded table to be used as source for data.

filename is the name of the target file. The interpretation of file name is similar to names in load statements, i.e. the directory statements apply.

format-spec ::= ( ( txt | qvd ) )

The format specification consists of a the text txt for text files, or the text qvd for qvd files. If the format specification is omitted, qvd is assumed.

Examples:

Store mytable into xyz.qvd (qvd);

Store * from mytable into xyz.qvd;

Store Name, RegNo from mytable into xyz.qvd;

Store Name as a, RegNo as b from mytable into xyz.qvd;

store mytable into myfile.txt (txt);

store * from mytable into myfile.txt (txt);

(The two first examples have identical function.)

pavanthota
Creator
Creator
Author

Hi Felim,

Thanks for your Reply

I am new to qlikview thats what i did not understand can you please  explain me simple way.

Thanks,

Pavan

Not applicable

UTF is the only type of export that you can currently do like this.

pavanthota
Creator
Creator
Author

Hi miguel\Fleming

1)Can you please help me how to write the macro for exporting table object in to txt file with "," delimeted .

2) can you tell me is there anyway to run the macro by using scrip (While reloading only)

3) Is there anyway disable reloading option  in active sheet.

Thanks

Pavan

Not applicable

the common uses to you have a txt file with comma delimited is for open in Excel.

Maybe you can to create your file in csv.

Here you are an example.

I hope help you.