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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Sanjay5
Contributor III
Contributor III

Global Variable for Directory Name

Is there a global variable to get the Directory Name in tCreateTemporaryFile component?

I see tCreateTemporaryFile_1_FILEPATH but there is no variable for Directory.

 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

You already have all the info you need.

If I assume your tCreateTemporaryFile component is named tCreateTemporaryFile_1 and that you are using a Windows system (for the path separators "\"), the code you will need is below.... 

String directory =
((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).substring(0, ((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).lastIndexOf("\\"));

View solution in original post

3 Replies
Anonymous
Not applicable

You already have all the info you need.

If I assume your tCreateTemporaryFile component is named tCreateTemporaryFile_1 and that you are using a Windows system (for the path separators "\"), the code you will need is below.... 

String directory =
((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).substring(0, ((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).lastIndexOf("\\"));
Sanjay5
Contributor III
Contributor III
Author

Thanks,

 

It's good trick. 0683p000009MACn.png

 

I wish there was a global variable name for the same something like tCreateTemporaryFile_1_DIRECTORY, as we have "tCreateTemporaryFile_1_FILEPATH"

 

Anonymous
Not applicable

Yo could always set the directory using a variable. Then you would have access to change it as well as see what it contains