Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
james_wynn
Contributor
Contributor

table name issue in loop to load all files in a folder

I can not name the table using '$(File)' to populate tblNm

OR; how should I use the file name to name a table and write a QVD?

// load all data extracts

for each File in filelist(loadPath &'\*.csv')

Load '$(File)' as Name;

// define tblNm

let pthNm = '$(File)';

let stNm = index('$(pthNm)','Polo');

let endNm = index('$(pthNm)','Extract_') + 7;

let tblNm = mid('$(pthNm)',$(stNm),$(endNm)-$(stNm));

//how do I name the table HERE?

//tblNm: attempt #1

//set tablename='$(tblNm)' attempt #2;

Load *

FROM

$(pthNm)

(txt, utf8, embedded labels, delimiter is ',', msq);

Store $(tblNm) into $(qvdPath)\$(tblNm).qvd

(qvd);

drop table $(tblNm);

next File

1 Reply
Miguel_Angel_Baeyens

Hi,

Since the table name is used only in QlikView and has nothing to do with the actual name of the QVD file, why don't you use the same table name but store it using the name you want? Something like

// load all data extractsfor each File in filelist(loadPath &'\*.csv') // define tblNmlet pthNm = '$(File)';let stNm = index('$(pthNm)','Polo');let endNm = index('$(pthNm)','Extract_') + 7;let tblNm = mid('$(pthNm)',$(stNm),$(endNm)-$(stNm)); Table:Load *FROM$(pthNm)(txt, utf8, embedded labels, delimiter is ',', msq);Store Table into $(qvdPath)\$(tblNm).qvd(qvd);drop table Table;next File


Hope that helps.