One Star

[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
1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

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

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
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
8 REPLIES
Moderator

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

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
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

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

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
Moderator

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

Hi,
How did you set your tFileUnarchive?
I think you should use ((String)globalMap.get("tWaitForFile_1_FILENAME")).
See my screenshots
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

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

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
Moderator

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

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
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

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

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
Moderator

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

Hi,
You are welcome. Thanks for your feedback and feel free post your issue on forum.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

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

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