tWaitForFile : how to know that no file has been detected

One Star jmd
One Star

tWaitForFile : how to know that no file has been detected

I specified a timeout time (in seconds) in tWaitForFile component
but at the end, how to know if no file has been detected ?
I tried a ((Integer)globalMap.get("tWaitForFile_1_CURRENT_ITERATION")) == 0 in a "if" link
But it dosen't work
What can I do ?
Moderator

Re: tWaitForFile : how to know that no file has been detected

Hi,
Component tWaitForFile provide several globalMaps.
You can get the file name and the number of iterations by using them.
For example, I have designed a job as:tWaitfile-->tjava(see my pic 12).
Get the globalMap in tjava
String filename=((String)globalMap.get("tWaitForFile_1_FILENAME"));
int Iteration=((Integer)globalMap.get("tWaitForFile_1_CURRENT_ITERATION"));
System.out.println(filename);
System.out.println(Iteration);

In tWaitFile, set the "a file is created" as trigger.
At last, when I create files in my directed folder, the result will give "filename" and number of "iteration" to us.
but at the end, how to know if no file has been detected ?
I tried a ((Integer)globalMap.get("tWaitForFile_1_CURRENT_ITERATION")) == 0 in a "if" link

If you want to get the number of detected files, you should define a counter by yourself and the code in tjava is
context.counter=context.counter 1;
System.out.println(context.counter);

(see my pic 3,4,5)
Please refer to 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 jmd
One Star

Re: tWaitForFile : how to know that no file has been detected

Thanks for your help
But I found the solution by myself :
To know if no file has been detected in a tWaitForFile component after its max duration (sort of timeout), we have to test the "((Integer)globalMap.get("tWaitForFile_1_CURRENT_ITERATION")) == <max iterations> " in a "if" link