Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: Evaluating table input rowset

  1. #1
    Join Date
    Apr 2007
    Posts
    12

    Question Evaluating table input rowset

    Given by a scenario is that when table input return no rowset, follow by Java Script Value step, this step will abort the transformation when table input has no rowset.

    I had many attempts in achieving this goal. However looks like no matter how i write the Java Script Value, it has no effect at all. Then I start looking into the codes, and found following snippet in ScriptValues class,

    public boolean processRow()
    {
    .........
    Row r=getRow();
    if (r==null) // no more input to be expected...
    {
    if (data.cx!=null) Context.exit();
    setOutputDone();
    return false;
    }
    .........
    addValue();
    }

    Looks like a null row got from previous rowset will prevent from any execution of this java script value step. Is this what we expected? if so, does anyone has a way out in my previous scenario, i need to abort the transformation once the table input return no data.

    Thx in advanced!

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    If the javascript doesn't get input it won't run its code... In the new version group by should work I think ... on empty input it will output 1 row with a 0 value.

    Regards,
    Sven

  3. #3
    Join Date
    Apr 2007
    Posts
    12

    Default

    thx for ur quick reply! Looks like i got the right logic. However i still need to ask is there any other way to make transformation aborted if there is no record return in table input? ur advices would be much appreciated.

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

    Default

    Like Sven said, count the rows with a "Group By" step, filter on a row count being 0 and allow that row to hit the "Abort" step.

  5. #5
    Join Date
    Apr 2007
    Posts
    12

    Default

    what version of group by step are you referring to? It seems has no effect as well in 2.5. thx!

  6. #6
    Join Date
    May 2006
    Posts
    4,882

    Default

    Right... it got fixed in 3.0

  7. #7
    Join Date
    Apr 2007
    Posts
    12

    Default

    Thanks Sven and Matt, i got what i needed.

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.