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: 
Anonymous
Not applicable

[resolved] Passing the created or present file of tWaitForFile to a subjob

Hi All,
I have a tWaitForFile component in my job.I want to pass the name of the file that is already present or created after the execution to a subjob. I used a context variable and set the value as ((String)globalMap.get("tWaitForFile_1_PRESENT_FILE")).It is working fine if the file is already present.But fails if the file is created after starting the execution.I need to run the subjob if the file is present or created later.How can i pass the name of the current file name?Please help.
Thanks,
Sreedevi
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,
The file is available in the folder.I doubt its just giving the filename alone without the path.Is it like that?Please confirm.

((String)globalMap.get("tWaitForFile_1_FILENAME")) is just the name of file, such as, "test.txt" without path.
((String)globalMap.get("tWaitForFile_1_CREATED_FILE")) provide the path and name together,such as,"D:/test.txt".
For your issue, did you set Directory in tFileArchieve? Could you please post your tFileArchieve setting screenshot into forum so that I can get your situation precisely.
Best regards
Sabrina

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hi,
It is working fine if the file is already present.But fails if the file is created after starting the execution.

What's the error? How did you choose your "Trigger action when"? Is it "a file is created or updated or deleted"? Did you check out the option "Wait for file to be released" in Advanced setting?
tWaitForFile
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi Sabrina,
The error is a null pointer exception in the subjob component.
Exception in component tFileUnarchive_1
java.lang.NullPointerException
at data_test.db_process_0_1.db_process.tFileUnarchive_1Process(db_process.java:1220).
The tWaitForFile_2 component is having the following settings.
Include Present File- checked
Trigger Action when- a file is created
Then - Exit loop
In Advanced ,Wait For file to be released is checked.
In the tRunJob component,a context variable is set as CSV_File=((String)globalMap.get("tWaitForFile_2_PRESENT_FILE")).
In the subjob,the tFileUnarchive_1 is having Archive File as context.CSV_File.
What could be the issue?
thanks,
Sreedevi
Anonymous
Not applicable
Author

Hi,
How did you set your tFileUnarchive?
I think you should use ((String)globalMap.get("tWaitForFile_1_FILENAME")).
See my screenshots
Best regards
Sabrina
0683p000009MEko.png 0683p000009MEo1.png
Anonymous
Not applicable
Author

Hi Sabrina,
I used ((String)globalMap.get("tWaitForFile_1_FILENAME")) as you suggested.Then am getting the error
Exception in component tFileUnarchive_1
java.io.FileNotFoundException: Sample1.zip (The system cannot find the file specified).
The file is available in the folder.I doubt its just giving the filename alone without the path.Is it like that?Please confirm.
I have appended path to the filename like "D:/data-testing/NewFiles/"+((String)globalMap.get("tWaitForFile_1_FILENAME")).Then its working.
Thanks,
Sreedevi
Anonymous
Not applicable
Author

Hi,
The file is available in the folder.I doubt its just giving the filename alone without the path.Is it like that?Please confirm.

((String)globalMap.get("tWaitForFile_1_FILENAME")) is just the name of file, such as, "test.txt" without path.
((String)globalMap.get("tWaitForFile_1_CREATED_FILE")) provide the path and name together,such as,"D:/test.txt".
For your issue, did you set Directory in tFileArchieve? Could you please post your tFileArchieve setting screenshot into forum so that I can get your situation precisely.
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi Sabrina,
The issue is solved after putting the directory with ((String)globalMap.get("tWaitForFile_1_FILENAME")).
Thank you very much for your help.
Sreedevi
Anonymous
Not applicable
Author

Hi,
You are welcome. Thanks for your feedback and feel free post your issue on forum.
Best regards
Sabrina
_AnonymousUser
Specialist III
Specialist III

Could you please post your tFileArchieve setting screenshot into forum so that I can get your situation precisely.