Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Champs,
Need your help for my issue.
My requirement:
I expect “*.csv” as source file. Once the file is in folder the job should transform into required format and drop it to output folder.
My job…
tFileList --> (iterate) --> tFileInputDelim --> (main) --> tMap --> (out) --> tFileOutputDelim
it works great.
My issues:
I am used “tWaitForFile” to achieve above. I made the job to run first time, and then it picks whenever there is a file.
tWaitForFile --> (iterate) --> tFileList --> (iterate) --> tFileInputDelim --> (main) --> tMap --> (out) --> tFileOutputDelim
Quest:
Quest:
Thanks heaps for your help. Happy to answer all your queries.
Regards,
K
Hello,
When there is no file, you could use tSetGlobalVar to set a variable (e.g. "FileProcessed") to false. Then OnSubjobOK to tWaitForFile with the appropriate time between iterations and max number of iterations. Connect tWaitForFile with iterate to another tSetGlobalVar to set the "FileProcessed" variable to true. Then have RunIf from tWaitForFile to tSendMail with the condition (Boolean)globalMap.get("FileProcessed")==false.
Let us know if it helps.
Best regards
Sabrina
Hi xdshi,
Sorry for the delay. Your solution works fine, but it didn't fulfill my requirement (screenshot attached fyr)
1) My job should process only CSV file. If any other formats in the folder, then it should trigger an alert email.
2) (or) if "no file" between 8am-10am then it should trigger an email, saying that "no file found".
I tried point 1 in your solution. Dropped a non-csv file to the folder, but nothing happened as 'twaitforfile' is waiting for CSV file.
Does it make sense?
regards,
Kiruba
Could you please change the file mask to accept all different types of files? Then once the file is identified, you can check the extension of file by storing the file name to a context variable and parse the extension of the file.
Please use a Run if condition to send the data flow to different paths. If the file is csv, you can follow existing path. If the file is not csv, follow different path where you can send the error email.
Coming to second query, you can do the whole process in a tLoop based on a while condition where the time is between start and end time. You can check the file and go to sleep for predefined interval (say 10 minutes). If you receive a file, set a context flag variable as Y. Even after 10 am, if the file has not reached, the flow will come out of loop and you can check whether flag is Y or N. If the flag is still N, you can send a error email through another Run if flow.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved