Hitachi Vantara Pentaho Community Forums
Results 1 to 8 of 8

Thread: Generating new rows

  1. #1

    Default Generating new rows

    I have a transformation in which I perform a number of validation steps. If there are any errors, the input record gets saved to a table with an error_count attribute indicating the number of errors. Each associated validation error is stored in a separate error_log table.

    How would one dynamically create rows in Kettle through JavaScript.

    Thanks

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Open up the FAQ (in your installation as under docs\english) and read the part on javascript... it's in there.

    Regards,
    Sven

  3. #3

    Default

    Thanks - are your referring to 'Tips' or should I have a FAQ document? In the Tips it talks about making a clone of a row.

    I need to potentially construct multiple new ROWS (with different fields than the input stream).

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    The document is called "PDI 2.5.0 - FAQ.pdf". It has examples how to make new rows and new fields.

    But remember all rows flowing over 1 hop have to be of the same structure.

    Regards,
    Sven

  5. #5

    Default

    Sven, thanks for the response. I did find the section that details how to add a row. My next question is how do I delete a row from the input stream.

    If I detect an error, I go down an error path in which I generate new rows (with a different format from the input row) for each error associated with the input. Given that all records on the output must be of the same format, I need a way to delete the input row.

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    Deleting is a problem as that's not under your control, so you can't.

    You can use 2 output hops e.g. 1 for error rows, and 1 for normal rows.

    Regards,
    Sven

  7. #7

    Default

    Sorry - I do not understand what you are proposing. Could you provide an example. I have filtered rows in error to a JavaScript step. What next ?

  8. #8
    Join Date
    May 2006
    Posts
    4,882

    Default

    I'm almost logging off... attach your transformation and I will try to see what you mean.

    What I meant is following: you have normal rows and error rows in the end which are different in structure. So you have to have 2 hops, 1 for the flow of the normal rows, the other for the flow of the error rows. How exactly you do it depends on how your current job is.

    Regards,
    Sven

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.