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

Use the import java.io.File statement in a job

Hello, 

 

I want to extract the parent folder of a file's path that i get from the context parameters (the path looks something like this c:\myFolder\File.csv, and i want to extract the c:\myFolder path) , so i can insert a file in the same folder as the one passed in parameters.

I want to use the File class of the java.io package so i can use the getParent() method to get the parent folder, the problem here is the import statement, for now i insert the import statement inside a tJavaRow component, but i can't use this method if my job does not have this component. 

 

My question is this: is there a way to insert an Import Statement that'll be applied to my job without having to use a tJavaRow to add the java.io.File statement? 

 

Best regards,

Ameen

Labels (3)
1 Solution

Accepted Solutions
akumar2301
Specialist II
Specialist II

To get the Path , 

 

Context.file = c:\myFolder\File.csv

 

String path = new java.io.File(Context.file).getParent();

 

View solution in original post

1 Reply
akumar2301
Specialist II
Specialist II

To get the Path , 

 

Context.file = c:\myFolder\File.csv

 

String path = new java.io.File(Context.file).getParent();