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: 
Anonymous
Not applicable

Export to txt (Store function)

Hello all, is there a way to auotmatically change the name of the file in the store function or a way where the store function will create multiple files instead of replacing the old file upon upload?

Export:

load

 
[csId] as 1

      ,
[eCd] as 2

      ,
[te] as 3

Resident Test;;

 
STORE export into

  (
txt, delimiter is ',');

 
drop Table export

8 Replies
pokassov
Specialist
Specialist

Hi!

LET vName=today();

STORE export into Q:\Monthly Reports\export_$(vName).txt (txt);

ecolomer
Master II
Master II

pokassov
Specialist
Specialist

Or you can use incremental

let vPath='C:\1';

  FOR Each Ext in 'txt'

  FOR Each File in FileList ('$(vPath)'&'\*.'&Ext)

  Files:

  LOAD

  '$(File)' as Name,

  FileSize( '$(File)' ) as Size,

  Replace(Replace('$(File)','$(vPath)'&'\',''),

  '.xlsx','') as ShortName,

  FileTime( '$(File)' ) as FileTime

  AutoGenerate 1;

  NEXT File;

  NEXT Ext;

t1:

Load

  max(PurgeChar(ShortName,'export_.txt')) as num

Resident

  Files

Where left(ShortName,7) = 'export_';

Let vName=Peek('num',0,'t1')+1;

drop tables Files, t1;

t1:

LOAD Items,

     Locations,

     Qty

FROM

(biff, embedded labels, table is Facts$);

//let vName=today();

STORE t1 into C:\1\export_$(vName).txt (txt);

Anonymous
Not applicable
Author

define a variable and use it to create new name to your file

or simple append your file name with some timestamp

like

STORE export into '';

Anonymous
Not applicable
Author

vDate=today();

[export] into Q:\Monthly Reports\export_$(vDate).txt

  (
txt, delimiter is ',');

OR 

STORE [export] into Q:\d771\F88776\SHARED\CompanyRead\Network Informatics\Special Projects\John Mingus\Qlikview\Monthly Reports\export_$(vDate).txt(TXT);

Not recogonizing the variable and I get an error to reload old data after the refresh. See anything incorrect with the syntax above?  When I remove the variable in the STORE statment  the scrip runs...

Anonymous
Not applicable
Author

Hi John,

Check out the attached application it has the similar code and it does work.

Please check if your access are proper to the folder where your application is trying to store the file

Anonymous
Not applicable
Author

My script runs when I remove the variable piece from the store command. It's only when I add the variable that the script bombs out "Execution of script failed. Reload old data"

Anonymous
Not applicable
Author

can you put a sample qvw replace your load statement with simple inline and keep table name and store statement variable etc same