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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
jmd
Contributor
Contributor

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 ?
Labels (2)
2 Replies
Anonymous
Not applicable

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
0683p000009MEBY.png 0683p000009ME4x.png 0683p000009ME8a.png 0683p000009MDvN.png 0683p000009MEBd.png
jmd
Contributor
Contributor
Author

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