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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to Dynamically get an Excel file name

Hi,

 I am using tFileInputExcel Component and how to get the input file on dynamically,

I use ((String)globalMap.get("tFileInputExcel_1_FILENAME")) in a field in tmap component but it doesnt work.
Any help?
 
 
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

You just need to use a tFileList to iterate each file in the specified folder, this component pre-define some global variables which you can use on other components, includes:
file path: (String)globalMap.get("tFileList_1_CURRENT_FILE"))
file name: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).
The job design looks like:
tFileList--iterate--tFileInputExcel--main--tMap-->

Hope it helps you!

Regards
Shong

View solution in original post

5 Replies
Anonymous
Not applicable
Author

is the file name a variable or fixed value on tFileInputExcel? You can use a context variable as file name, for example:
"D:/file/"+context.filename
And then, you can get the file name using context.filename on any other components.

BTW, please insert your images into post body instead of attaching it.

Regards
Shong
Anonymous
Not applicable
Author

Hi,
Could you please let me know where should I need to add this context.filename and my input file name is not fixed, it's a dynamic name.
Anonymous
Not applicable
Author

In the Context view, you can define a variable. To use a variable, the format is: context.varName
Can you please explain why the file name is a dynamic name in your case? So that I can give you an accurate answer.

Anonymous
Not applicable
Author

Hi,
Thanks for your reply,
I want to read the files from a folder. The filename should be changed dynamically like
report(1).xlsx
report(2).xlsx
report(3).xlsx
How do I read the files from the folder? at the same time, I wants to store the read file name into the table.
Anonymous
Not applicable
Author

You just need to use a tFileList to iterate each file in the specified folder, this component pre-define some global variables which you can use on other components, includes:
file path: (String)globalMap.get("tFileList_1_CURRENT_FILE"))
file name: ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")).
The job design looks like:
tFileList--iterate--tFileInputExcel--main--tMap-->

Hope it helps you!

Regards
Shong