Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Case or similar step in Kettle

  1. #1
    Join Date
    Feb 2017
    Posts
    5

    Default Case or similar step in Kettle

    Hi,

    I'm working on something I don't know how to solve it and I would like someone to suggest me a possible solution.
    I'm developing an ETL. This ETL have information coming from tables that I have joined together in one step. I need to check if this data (coming from tables) is correct or not.
    I also have an excel whith different criterias that would help me to validate the data:
    for example if a=0 b=1 and c is null, d should be 2
    I have joined the information coming from tables and the excel with a 'Join rows (cartesian product) and in this step, I match information from the excel with the information coming from the tables
    For validating one field I have code like this


    condition1
    or
    condition2
    or
    condition3
    or
    condition4




    ordered from the more restrictive to the less.
    What I really need is that if condition2 is true, I don't want to check condition3 either condition4 and I don't know how to do it.


    Thank you for your time.

  2. #2
    Join Date
    May 2014
    Posts
    358

    Default

    How did you implement it so far? Using a Filter rows step you should be able to define such a filter that if condition 2 is met, conditions 3 or 4 don't matter. Whether or not the checks are done or not doesn't have to concern you, CPU cycles are cheap.
    Otherwise you can write in a Java or Javascript steps whatever pleases you.

  3. #3
    Join Date
    Feb 2017
    Posts
    5

    Default

    I have data coming from tables: TA, TB, TC, TD, TValue1, TValue2 and I also have an excel sheet with criteria for validating if TValue1 and TValue2 are correct taking into consideration the value of TA, TB, TC and TD
    This is what I have in the excel sheet.
    A B C D Value1 Value2
    20 0 0
    20 1 415 0
    20 1 0
    20 1 1 4

    Blank means, all values are OK, so, when I have a A=20 and B=1 and C=415, it matches with the second and third line.
    If TA=A and TB=B and TC=C and TD=D (this match is done in the Join rows (cartesian product))
    then TValue1=T1 and TValue2=T2 (this check is done in the ‘Filter rows’)
    I’m using a Join rows (cartesian product) to have the information coming from the tables and coming from the excel in one line.
    Inside the ‘Join Rows’ (cartesian product) step I have this code for checking if TA=A:
    condition1
    or
    condition2
    or
    condition3
    or
    condition4
    But I only want to match the information once. If it matches because of condition 1, not to test the rest
    In the ‘Filter rows’ step I really validate my data

  4. #4
    Join Date
    May 2014
    Posts
    358

    Default

    But if A=20, the cartesian join does match the row correctly, doesn't it?

  5. #5
    Join Date
    Feb 2017
    Posts
    5

    Default

    Not really.... It gives me back two lines, and I only want one. The first one that matches

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.