Hitachi Vantara Pentaho Community Forums
Results 1 to 3 of 3

Thread: Ues parameter value in new field

  1. #1
    Join Date
    Nov 2016
    Posts
    2

    Default Ues parameter value in new field

    I am exploring Kettle as a new user.

    I have set a parameter in a transformation, and I want to use the parameter value in a new derived field. I have looked at both Calculator and Formula, but can't find any idea to get the value in the parameter down to a new field.

    What is the best way to approach this? Do I need to write java/java script to accomplish this?

    What if I want to use it as part of the condition? For example for something like
    if input_field_1 = ${parameter_value}
    then set to 1
    else set to 2.

    This derivation will be performed at row level.

    Thanks

    L

  2. #2
    Join Date
    Aug 2011
    Posts
    236

    Default

    Hi Longma98,

    How about 'Value Mapper' ? You might have to have a get variable step to get the ${parameter_value} value usable in the transform.

    Name:  value_mapper.jpg
Views: 617
Size:  20.6 KB

    HTH
    PDI 8.0.0
    MySQL - 5.6.27
    Redshift - 1.0.1485
    PostgreSQL 8.0.2
    OS - Ubuntu 10.04.2

  3. #3
    Join Date
    Nov 2016
    Posts
    2

    Default

    Hi,

    you can get variables directly in the calculator step, it requires two calculations:
    1. "set field to constant value", with "${yourVariableName}"
    2. "variable substitution"

    you cannot get variables in the formula step directly

    you can always use get variables step to save the variables as fields

    regarding the "if-then-else":
    - calculator step cannot do it, which is a big omission, in my opinion
    - formula step can do it
    - java expression can do it using the ternary operator (condition ? expr1 : expr2)

    Hope this helps,

    uki

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.