Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
julioarriaga
Creator II
Creator II

"Store 'Name' into 'Name.txt' (txt)" is creating the txt file

Hi guys,

Thanks in advance for your help. I have this code that works without problems but it is not generating the txt file 'Sales'. I frankly don't know where is the error (all the Set parts, were ommited in this copy for the sake of clarity).

Kind regards.

Capture1.PNG

1 Solution

Accepted Solutions
julioarriaga
Creator II
Creator II
Author

Thanks for every reply.

I found the problem. In a previous code's tab, I entered a '/*' to comment an entire section but I didn't put the '*/'. So, it wasn't executing the rest of the code, although it wasn't formatted to green.

Apologies for the silly mistake.

Thank you for your help.

View solution in original post

8 Replies
Anil_Babu_Samineni

Rather txt use qvd in your store line like below

STORE Sales into Sales.txt (qvd);

OR

Even, this should work

STORE Sales into Sales.txt;

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
techvarun
Specialist II
Specialist II

STORE Sales into Sales.txt(txt, delimiter is ',')

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The script you posted should create "Sales.txt" in the current directory.  Do you have any DIRECTORY statements that change the current directory?  It would be helpful if you could post the script logfile.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

mangalsk
Creator III
Creator III

Your code is creating xml data set rather STORE Sales into Sales.txt(txt, delimiter is ',') will store only data in , separated way

qv_testing
Specialist II
Specialist II

txt also should work.

STORE Sales into Sales.txt;

this stores like

Customer,Sales

ABC,65

XYZ,20

TRE,56

HJK,75

fgh,45

STORE Sales into Sales.txt(txt); and

STORE Sales into Sales.txt(qvd);

both stores XML format

shiveshsingh
Master
Master

From Help

Store

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 ];

where:

*fieldlist::= ( * | field ) { , field } ) - A list of the fields to be selected.

Using * selects all fields.

field::= fieldname [ as aliasname ]

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.

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.

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.)

julioarriaga
Creator II
Creator II
Author

Thanks for every reply.

I found the problem. In a previous code's tab, I entered a '/*' to comment an entire section but I didn't put the '*/'. So, it wasn't executing the rest of the code, although it wasn't formatted to green.

Apologies for the silly mistake.

Thank you for your help.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Yes, that's a common and difficult bug/feature.  Syntax highlighting is reset at the beginning of each tab.  So if you forget a terminator such as semicolon or */ on a previous tab, it won't be noted on the coloring of the next tab.  Try this one for frustration:

///$Tab Main

SET myvar= xyz

///$Tab Orders

Orders:

LOAD *,

     Year(OrderDate) as Year;

LOAD *

FROM Orders.qvd (qvd);

If you run this script, you will have no script error but you will not have a Year field in the Orders table!  If you look in the log the "Year(OrderDate) as Year" looks normal, but it's not actually a preceding load. It's been consumed into the variable myvar;


-Rob