Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
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;
STORE Sales into Sales.txt(txt, delimiter is ',')
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
Your code is creating xml data set rather STORE Sales into Sales.txt(txt, delimiter is ',') will store only data in , separated way
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
From 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.
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.
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.)
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.
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