Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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

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


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

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)