Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Set Variable - Usage Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Posts
    8

    Default Set Variable - Usage Problem

    Hi - I am using "Copy Rows to Result" and "Get Rows from Result" with "Set Variable" combination to do some processing. However, Set Variable throws an error that it can only accept one row at a time. I corrected this by specifying 'Execute one row at a time' on the transformation having "Copy Rows to Result". However, now I see that only the last row is processed. Any help is appreciated.

    LG

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

    Default

    Alll rows are processed but only the last one "sticks"

    If you're always setting the same variable you need to re-think your processing.
    If you want to set multiple rows using variable names coming from the input rows you need to use a javascript step.

    Regards,
    Sven

  3. #3
    Join Date
    Jul 2007
    Posts
    8

    Default

    Okay. I will look at the javascript option. The requirement was to run nested loops and utilize Set Variables to pass certain values to inner loop. I shall try the javascript option.

    However, is the approach to specify 'Execute one row at a time' correct or is there some other way to get the Set Variable working when we have input coming from Copy rows?

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

    Default

    set variables only accepts 1 row... the variable to set are hardcoded (except it possibly the latest trunk version, which makes it even more complex) so receiving multiple rows doesn't make sense.

    If you use "execute for each row" it only makes sense if you do the processing in the same subpart of your job/transformation... if you execute for each row only for the setting of the variables and then think you can do the rest of the processing afterwards you will only see the last variable being set.

    So you need some kind of subjob. Have a look at "process all tables" in the samples directory, or have a look at one of the last "weekly tips" on variables.

    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.