Search code examples
pentaho-data-integration

In Pentaho Data Integration can I output conditionally?


I need to output a different CSV file every 100 rows. For example, if there are 305 rows in a stream, I'd need to output a CSV for rows one through 100, 101 to 200, 201 to 300, and 301 to 305.

I got a column for the last row number, and built a page number variable which increments every 100 rows. I then tried searching online since I can't yet conceptualize a solution.


var numberOfInvoicePages = Math.ceil(Number(lastRow) / 300);

if(rowNumber % 300 == 0){
    pageNumber += 1;
}

I expect to get a CSV which says ${baseTitle} ${pageNumber} for each page, and for the actual results I don't yet know how to build this.


Solution

  • In the Text File output step, you can adjust on how many rows the output will split to another file, under the option 'Split ever ... rows'.

    enter image description here