Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: "=IFNA" PDI-style?

  1. #1
    Join Date
    Feb 2011
    Posts
    840

    Default "=IFNA" PDI-style?

    Any ideas on how to do it? I'm running a simple division calc on Calculator step, which SHOULDN'T have division by 0... but while testing, I've stumbled upon one near the very end. Any ideas on how to "IFNA, set 0", instead of letting Calculator step explode with that error? =p
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

  2. #2
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    =IF(ISERROR(<FUNCTION>),0,<FUNCTION>)

    ?

    You may have to adapt it - I'm PDI-less at the moment.

    EDIT:
    Ok, re-read it a bunch... Not with Function step, but with Calc.
    Is your denominator being calculated within the same calculator step?

    If not, then use an If step, with a set constant step then merge the flows...
    Code:
    <Incoming Stream> -- IF denominator <> 0 -- <Existing Calculator step> -- +--<Rest of existing flow> 
                                           ELSE -- Add Constant --------------|
    Last edited by gutlez; 05-29-2013 at 03:59 PM.
    **THIS IS A SIGNATURE - IT GETS POSTED ON (ALMOST) EVERY POST**
    I'm no expert.
    Take my comments at your own risk.

    PDI user since PDI 3.1
    PDI on Windows 7 & Linux

    Please keep in mind (and this may not apply to this thread):
    No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.
    Signature Updated: 2014-06-30

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

    Default

    Filtering is one option, but a NULL IF step can guard the Calculator against a zero denominator, too.
    No quotient will be calculated as soon as a null value takes part in a division, so it's easy to identify those rows downstream if necessary.
    So long, and thanks for all the fish.

  4. #4
    Join Date
    Feb 2011
    Posts
    840

    Default

    The idea of filtering came to my mind, can't remember now why I hadn't used it...
    (it was holiday yesterday, cut me some slack =p )

    I thought null would give error too. Nice, thanks for that tip marabu! =)
    Join us on IRC! =)

    Twitter / Google+ / Timezone: BRT-BRST
    BI Server & PDI 5.4 / MS SQL 2012 / Learning CDE & CTools
    Windows 8 64-bit / Java 7 (jdk1.8.0_75)

    Quote Originally Posted by gutlez
    PLEASE NOTE: No forum member is going to do your work for you. We will help you sort out how to do a specific part of the work, as best we can, in the timelines that our work will allow us.

    I'm no expert.Take my comments at your own risk.

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.