Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Value mapper - several fields

  1. #1

    Default Value mapper - several fields

    Hello everyone. I was wondering if there is a step to map the value of several fieldss to a new field.

    For eaxample, if field1 is equal to A and field2 is equal to B thrn newfield is equal to C. Else, if field1 is equal to A and field2 is equal to D then newfield is equal to Z. And so on. It is a if...else statement but with several fields.

    I currently use javascript to do this and I was wondering if this can be dine in a different way.

    thanks

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

    Default

    Stream-Lookup can be used with n-ary lookup functions.
    If you want to use Value-Mapper you must reduce your binary lookup function to a unary one by combining field1 and field2 in a single field, first.
    So long, and thanks for all the fish.

  3. #3

    Default

    Thanks for your answer. I think this solution works when all the conditions are "equal". For example:

    If field1 is equal to A and field2 is equal to B, then newfield is C

    what would be the approach when the comparison is not an "equal"? For example something like this:

    if field1 is greater than A and field2 is lower than 100, then newfield is C

    also, there is step to do IF....ELSE statements?

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

    Default

    A User-Defined-Java-Expression would be my first choice.
    Depending on your requirements you might be fond of Rule-Executor, instead.
    For IF ELSE functionality you should look at Filter-Rows, Java-Filter, Switch-Case steps, too.
    So long, and thanks for all the fish.

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.