Search code examples
kettlepdi

How to split records based on a value field in a column


i have a scenario like the below ...where based on value of num_seats i have to split the rows in target into that amount of data along with another field(seat_num) which will be having counter which will increment by 1.Please suggest..

enter image description here


Solution

  • You can clone the rows based on a field value (in this case, num_seats), remove the original (non-cloned) row, then calculate the seat number and replace the original fields (num_seats, seat_num, last_seat, etc.) with the new values:

    enter image description here

    Here's a Gist of the above transformation: https://gist.github.com/mattyb149/e4cf796ff45983ebf87e