Search code examples
kettlepentaho-spoondata-integrationpdi

How to check if the file contents exist in Kettle PDI


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.


Solution

  • 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.