Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Passing values from one transf to the next one

  1. #1
    Join Date
    Nov 2013
    Posts
    382

    Default Passing values from one transf to the next one

    I know this has been addressed several times and I feel like a noob trying to find it!

    I need to execute a transformation with a parameter to be used on its Table input step ("select ... where xx=VALUE") , the transformation has to be executed for every row of a previous select step that will provide the VALUE to be used.

    Just now I'm having a confusion between parameters/args and how to use them in the correct way. Can anyone send me to the correct doc? (I will copy it by hand one dozen times, promised! )

  2. #2
    Join Date
    Apr 2008
    Posts
    4,690

    Default

    Transform 1 ends with "Copy Rows to Results"
    Transform 2 declares Parameter "xxVALUE" (used in the Table Input as "select ... where xx=${xxVALUE}" quoting may be required!)
    In the Job, on the step for Transformation 2, go to Parameters tab, and define the Parameter mappings correctly. On the Advanced tab, check the Execute for every input row.

    But...
    Why does it need to be run in separate transforms?
    You *CAN* go <Transform 1 steps> -> Table Input (select ... where xx=? ) and JDBC will take care of the quoting for you, and PDI will run the table input once for each row (assuming you check the appropriate boxes)

  3. #3
    Join Date
    Nov 2013
    Posts
    382

    Default

    Hi thanks for the answer. In the meantime I found this post http://forums.pentaho.com/showthread...-of-a-CSV-File and got it work ... although it seems more complex than your solution. Will try yours also.

    I cannot have a single transaction because for every value of select1 I have to create a diferent output file (with the value as part of the file name).
    Last edited by DepButi; 11-13-2014 at 11:54 AM.

  4. #4
    Join Date
    Nov 2013
    Posts
    382

    Default

    Hi gutlez,
    I cannot make your solution work.

    The variable ${my_param} is not recognized on transformation2 and I end up with a select with no substitution

    select ... from ... where zz='${my_param}'

    I cannot either use it on the filename box, so I end up with a created file named

    myfile${my_param}.txt


    In fact this is what I tried before posting initially. And my confusion arises from the fact that ${my_param} is the sintaxis for a variable, but parameters are used selecting them from a list of available parameters on a field (using CTRL-space).

  5. #5
    Join Date
    Apr 2008
    Posts
    4,690

    Default

    Did you declare the parameter in Transform 2? (Hint: Open Transform 2 and press Ctrl-T and then go to the Parameters tab)

  6. #6
    Join Date
    Nov 2013
    Posts
    382

    Default

    Quote Originally Posted by gutlez View Post
    Did you declare the parameter in Transform 2? (Hint: Open Transform 2 and press Ctrl-T and then go to the Parameters tab)
    That's it!! (I now remember reading this in the doc )

    Thanks a lot, it works fine now ... and a lot easier to understand and maintain than the solution pointed out in the other post.

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.