tWaitForFile - Only works for first iteration

One Star

tWaitForFile - Only works for first iteration

Hello,
I have a job, where I'm loading an Sql database from an Excel file.
The database should be loaded everytime a new excel file is created in a specific directory, so the job has to run everytime a new excel file is created.
The excel file has always the same name.
So, I'm using the followinf flow:
tWaitForFile-----iterate-- -->tFileInputExcel------>tMap------->tMSSqlOutput
The problem is that the only the first file I save in the specific directory is processed, all the other I save there, nothing happens.
Do you have any ideia why this happens?
THanks
RV
One Star

Re: tWaitForFile - Only works for first iteration

Hello,

have you configure the the action of trigger on contihue loop ?

jeremie
One Star

Re: tWaitForFile - Only works for first iteration

Hi,
the trigger is configure the following way:
Trigger action when: a file is created
Then : continue loop
the file can always have the same name, right?
RV
One Star

Re: tWaitForFile - Only works for first iteration

Hi,

I receveive your email.
what is your version of TOS because it works fine in TOS 2.4.1

What dou you use in the File Name on tExcelInput : the global variable of the tWaitForFiles : ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")) ?


Jeremie
One Star

Re: tWaitForFile - Only works for first iteration

Hi Jeremie,
thanks for answering so fast.
I'm using TOS 2.3.2 (perhaps it's a version issue)
I'm not sure I understood what you meant, shoul I have a global variable in the file name ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")), or should I have the path where the file is located?

Thanks
RV
One Star

Re: tWaitForFile - Only works for first iteration

hi,

thanks for answering so fast.
it's normaly


I'm using TOS 2.3.2 (perhaps it's a version issue)

Some bug are related from previous version.

I'm not sure I understood what you meant, shoul I have a global variable in the file name ((String)globalMap.get("tWaitForFile_1_CREATED_FILE")), or should I have the path where the file is located?

I see your capture for tExcelInput and it's ok.
I test tWaitForFiles-->tInput Delimited -->tLogRow on 2.3.2 : Its OK Smiley Sad

some bug from tExcelInput ?

Else can you testing tRunJob for the last of the process.

Sorry

jeremie
One Star

Re: tWaitForFile - Only works for first iteration

I have exactly the same behaviour.
After putting a file ( sample.zip) I cannot put it another time if the setting is "On file Creation": In that case I have to rename my file to be detected by the tWaitForFile component, that way it is always detected. It looks like the detected file name is persisted somewhere.
I tried to change the trigger setting with "On Create, Update or Delete" and this way the trigger works even the created file have the same name.
Is this a known issue? I am using TOS 4.1.2 and 4.1.1 on another workstation.
Thanks for help
Patrick
Seven Stars

Re: tWaitForFile - Only works for first iteration

I've raised this is tWaitForFile to detect replacement file in create/update mode. Please vote for it! Smiley Happy
One Star

Re: tWaitForFile - Only works for first iteration

Thank you for your answer.
I voted for.
Note that this behavior is the same in the latest TOS version 4.2.3.
One Star

Re: tWaitForFile - Only works for first iteration

Hi,
i'm also currently experiencing problems with the twaitforfile component.
To test the component, i used the twaitforfile component with a tjava component (with an iterate connection) which basically outputs all the twaitforfile variables on the console.
The tjava component contains the following code:
System.out.println(((String)globalMap.get("twaitforfile_1_CREATED_FILE")));
System.out.println(((String)globalMap.get("twaitforfile_1_ERROR_MESSAGE")));
System.out.println(((String)globalMap.get("twaitforfile_1_CURRENT_ITERATION")));
System.out.println(((String)globalMap.get("twaitforfile_1_PRESENT_FILE")));
System.out.println(((String)globalMap.get("twaitforfile_1_DELETED_FILE")));
System.out.println(((String)globalMap.get("twaitforfile_1_UPDATED_FILE")));
System.out.println(((String)globalMap.get("twaitforfile_1_FILENAME")));
System.out.println(((String)globalMap.get("twaitforfile_1_NOT_UPDATED_FILE")));
The twaitforfile component is configured as follows:
filemask: "*.txt"
Iteration interval: 5s (infinite loop)
Action: when file is created
When i copy new txt files into the directory which is being scanned, the twaitforfile component kicks in but i receive "null"-values from the variables in the tjava component.
Am i doing something wrong or is this definitely a bug?
Tested in TOS 4.1.2 and 4.2.3.
Thanks!
One Star

Re: tWaitForFile - Only works for first iteration

Hi,
unfortunately, there weren't any replies yet. I would be grateful for any suggestions for my problem above.
Thanks!
One Star

Re: tWaitForFile - Only works for first iteration

You may need to set the trigger action to updated if the file is not deleted after processing.
One Star

Re: tWaitForFile - Only works for first iteration

Hi All,
I know it is an old topic but still existing problem. I've been fighting with this issue for a while and couldn't find any sensible solution on this forum (which anyway is great!), so I decided to share the solution I've found, maybe it will help someone else in the future.
My workaround is to use an infinite loop to iterate a child job with tWaitForFile placed in it and then iterate the main process. The tWaitForFile is configured to run only once. Find attached the pictures of the process. Ignore the tMap and ContextLoad, they are used to load the filename to a context.
It is simple solution and for me works perfectly!
One Star

Re: tWaitForFile - Only works for first iteration

he database should be loaded everytime a new excel file is created in a specific directory, so the job has to run everytime a new excel file is created.
One Star

Re: tWaitForFile - Only works for first iteration

Hi,
here is another work around similar to kelebek but compact.
just place tInfiniteloop------before tWaitforfile------>tWaitforFile(exit loop when file create)-------->remaining flow.
Even you place file with same name for each iteration, it will work!!!
One Star

Re: tWaitForFile - Only works for first iteration

Hi,
here is another work around similar to kelebek but compact.
just place tInfiniteloop------before tWaitforfile------>tWaitforFile(exit loop when file create)-------->remaining flow.
Even you place file with same name for each iteration, it will work!!!
Four Stars

Re: tWaitForFile - Only works for first iteration

I have "OnComponentOK" from a tSendEmail to the subjob.  I iterate to the tSendMail for the execution and  The email has a global getCurrentDate in the subject line so I get the timestamp of execution.  
tWaitForFile --iterate--> tSendEmail (getCurrentDate)
                                        |  
                              OnComponentOK
                                        |
                                    Subjob
Four Stars

Re: tWaitForFile - Only works for first iteration

Also, the tWaitForFile is on "continues loop" so when a date is added to the file it is watching (a separate job that is output as a web service), this tWaitForFile job picks up that the file was updated and sends another email (iterated line) which kicks off the subjob again. This allows the customer to execute the Talend Job on-demand using a web browser URL without us having to manually start it in Talend.