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

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

Add a new column with the name of the folder where it is hosted

 

I am creating a .csv data import project to a postgresql database. and I want to add a new column that takes the name of the folder where the file is being collected, it is possible to do it, and how can I do it.

 

I am using tFileList to recover the files in the specific folder and save all the files in the same table.

 

please help me

Labels (5)
3 Replies
Anonymous
Not applicable
Author

This is quite an easy requirement to fulfil given you are already using the tFileList. All you need to do is add a tMap component somewhere in the flow after the tFileList. Then add a "folder" column. The folder column, you would simply use to one of these globalMap variables....

 

((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))
((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))
Anonymous
Not applicable
Author

thank you, but with 

((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))

i have the name of file data.

 

and with

((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))

All directory ex: C:\User\Documents\data\info.

 

i need only the name of folder

 

Anonymous
Not applicable
Author

Given the example in your last post, would your folder name be "info"? If so, all you need to do is extract "info" from this variable. Some code to do that can be seen below...

String path = "C:\\User\\Documents\\data\\info";

String folder = path.substring(path.lastIndexOf('\\')+1);