Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Kettle for Dummies - II

  1. #1
    Join Date
    Jun 2006
    Posts
    5

    Default Kettle for Dummies - II

    Hi,

    I have another basic doubt here. I have a DB table that has a field called Age.

    I need to do this:

    If Age is null
    replace it with Average(age)
    else
    Age

    How can I do this? Can someone please help?

    Thanks
    Raghav

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Kettle for Dummies - II

    Well, the easiest is to simply make a table input step

    SELECT avg(age) avgAge FROM someTable;

    Then send this to an Update step with a where age is null clause.

    Seems pretty simple to me :-)

    Matt

  3. #3
    Join Date
    Jun 2006
    Posts
    5

    Default RE: Kettle for Dummies - II

    Hi Matt,

    Of course that was simple - thanks. Only that I need to know how to create a new variable that will store these values - the average of the field where its null or the field value itself.

    Thanks again!
    Raghav

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default RE: Kettle for Dummies - II

    Just a wild guess of-course, but you might consider using the "Set Variables" step for setting variables...

  5. #5
    Join Date
    Jun 2006
    Posts
    5

    Default RE: Kettle for Dummies - II

    This is what I did:

    In my table input, I wrote the query: "select avg(age) as AgeAve from test"

    I got the average as 527 (dont bother about the number)

    I pull this into an update step. how do I configure this?

    What do I do next?


    Raghav

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.