Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
mrjohn23
Creator III
Creator III

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

bhagirath
Creator III
Creator III

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

mrjohn23
Creator III
Creator III
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...

bhagirath
Creator III
Creator III

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

mrjohn23
Creator III
Creator III
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"

bhagirath
Creator III
Creator III

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