Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Load dynamic field name from imported file name


Hi, i am left joining load all the qvd files in a specific directory folder to an existing qvw file table called Data. All the joining files contain two fields (LNUM the key and CUPB). I am trying to dynamically rename the CUPB field from each file as the name of the file from which it is imported, but I can not figure out how to pass a variable name to a field label. I keep getting an error that sees the name for the CUPB field as ' '

Binary c:\Data\201305\201305.qvw;
For Each vFileName in FileList ('C:\Data\BalHist\*.qvd')
Let vFName = FileBaseName();

Left Join (Data)
LOAD
LNUM,
CUPB as $(vFName)
From [$(vFileName)](qvd);
NEXT;


Thanks.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:  LET vFName = subfield('$(vFileName)','\',-1);


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Try:  LET vFName = subfield('$(vFileName)','\',-1);


talk is cheap, supply exceeds demand
Not applicable
Author

Thank you. This returned the name of the file in addition to the .qvd extension. I simple added a take of the characters to the left of the .qvd extension and it work as expected. Thanks again.
vFName = left(subfield('$(vFileName)','\',-1),6)