Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: How to set a variable by using sql script result,and use it in table input

  1. #1
    Join Date
    Dec 2015
    Posts
    3

    Default How to set a variable by using sql script result,and use it in table input

    the case is, i want to get a result from a sql script, and use it in table input as a variable.

  2. #2
    Join Date
    Aug 2013
    Posts
    100

    Default

    Best way you can use get and set variable step.

    Another approach you can use copy row step to copy the sql result set and passed that result set in table input.

    Regards
    Sumit

    Quote Originally Posted by farno View Post
    the case is, i want to get a result from a sql script, and use it in table input as a variable.

  3. #3
    Join Date
    Dec 2015
    Posts
    3

    Default

    Quote Originally Posted by Sumit_Bansal View Post
    Best way you can use get and set variable step.

    Another approach you can use copy row step to copy the sql result set and passed that result set in table input.

    Regards
    Sumit
    my kettle version is 6.0, i used a table input step to get the result and set it as a named variable, and try to use it in another table input as a param(replace variable in sql checked), but always can not get the value,
    how to make this work.

  4. #4
    Join Date
    Jun 2012
    Posts
    5,534

    Default

    You can't define and use a variable in the same transformation.
    Use a Job with Trans-1 to retrieve the variable value via Table-Input and preserve it via Set-Variables.
    You can use the variable now in a subsequent transformation.
    So long, and thanks for all the fish.

  5. #5
    Join Date
    Oct 2013
    Posts
    216

    Default

    You can also use two table input, in which in second table input you can specify "Insert Data from step", with tick "replace Variables in script", Use ? as a variable coming from first Table Input step.
    -- NITIN --

  6. #6
    Join Date
    Dec 2015
    Posts
    3

    Default

    Quote Originally Posted by nitin_pipalia View Post
    You can also use two table input, in which in second table input you can specify "Insert Data from step", with tick "replace Variables in script", Use ? as a variable coming from first Table Input step.
    awesome, thanks dude. It works.

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.