I have a job at Kettle that send an email based on a csv. But sometimes that csv have no content, and I would like to know how can I only send the email when the csv file isn't empty.
Asked
Active
Viewed 2,578 times
1 Answers
1
You can use the Get file names step that, among other info, tell you the file size and then filter all files with 0 bytes or below a certain threshold.
Or you can read the file (with a limit, so as to not read a lot of rows), count the rows and conditionally send the file only if the count is >0.
Both approaches will require a job to orchestrate the process.

nsousa
- 4,448
- 1
- 10
- 15
-
I did the count rows step, but I don't know how can I conditionally send the file if the count is > 0. I tried to use the filter rows, but it didn't work. So, how can I only send the file if the count is > 0 ? – mvitti Jan 04 '18 at 15:50
-
I found a condition, "Evaluate files metrics" but it works if I have just one file in the email. Because if one file have the bytes > 1 the whole process of sending the files is aborted. I need to just don't send the empty file – mvitti Jan 04 '18 at 16:48
-
You need to use a job and a transformation for that: the transformation merely determines whether there's content on the file and sets a variable with a flag to indicate that. Then the job can evaluate that variable to determine what to do next. – nsousa Jan 08 '18 at 13:59