Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: keeping a value from previous row?

  1. #1

    Default keeping a value from previous row?

    Hi everyone...
    I am a few days old to Kettle and I have been having trouble with trying to keep a field from previous row of an input file within a transformation.
    From what I see is that for each step (text input) I can only see and process the current row. Is that true?
    I wonder if I can use the "set variable" step to temporary storing the current row field values so that they can be visible within a transformation... but so far I don't have any luck...
    Are there any other ways to achieve that?
    thanks in advance!

  2. #2


    Hi Alex,
    You can not use the "Set variable " in your case because this step accept one row at time!!!!
    The only way is to write a piece of Java script.
    1- after your "Text input" step, insert a "java script" step
    2- Write inside a script like

    var prev;


    //at the end of script
    prev =Value.getString()

    where value is your field (in my example a string, but should be a number...) and prev contain the previous value.

    Last edited by shassan2; 04-18-2007 at 04:35 AM.

  3. #3


    It's working now! Thanks very much!
    But now I have another question: how can I define the type of the var?

  4. #4


    In your example, the type of the var is defined by the previous step (Text file input) so the JS will "only" get the value.

  5. #5


    many Thanks!

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.