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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Get the file name of the tfileInputDelimited

Hi,
I would like to display the file name of a tfileInputDelimited in a tMsgBox.
I try this but this doesn't work : (String)globalMap.get("tFileInputDelimited_1__FILENAME__")

How can I do ?
Labels (2)
3 Replies
Anonymous
Not applicable

Hello
There is not such a global varialbe: (String)globalMap.get("tFileInputDelimited_1__FILENAME__"), so you can't use it directly.
But you can put the file in a folder and use a tFileList component to iterate it. There is a global variable(press Ctrl+Space bar can see all the global variables in text fileds):
((String)globalMap.get("tFileList_1_CURRENT_FILE"))
Best regards
shong
0683p000009MCAK.png
_AnonymousUser
Specialist III
Specialist III
Author

Ok thx for the answer !
And now if I want to write the rows of the input file in a output file but in replacing the whitespace in the input filename by underscore in the output filename, must I use a routine ?
It works in using a routine but I have to use the currentFilePath and the currentFile like this :
-- In the output FileName --
MyRoutine.replaceFileName(((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")),((String)globalMap.get("tFileList_1_CURRENT_FILE")))
-- My Routine --
public class MyRoutine{
public static String replaceFileName(String path, String fileName) {
return path.replaceAll(fileName,replaceWhitespaceByUnderscore(fileName));
}

public static String replaceWhitespaceByUnderscore(String fileName) {
return fileName.replaceAll(" ","_");
}
}

But is there an easier or more stylish way to do it ?
Anonymous
Not applicable

Hello
But is there an easier or more stylish way to do it ?

The tReplace component can archive the same function instead of routine.
Best regards

shong
0683p000009MCAP.png