in

 

Replace Null with Zero

Last post 09-05-2008 7:04 AM by christulino. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-24-2008 9:25 PM

    Replace Null with Zero

    There has already been a few posting around problems with nulls in calculations.
    Has anyone found a way to replace a null with a zero?

    I am yet to find a way to calculate against an inserted zero after trying:

    case

    when [Hours Worked] is null then 0
    when [Hours Worked] is null then '0'
    when [Hours Worked] is null then ('0')
    when [Hours Worked] is null then [Zero] (where [Zero] is a Data Item with value 0)
    when [Hours Worked] is null then cast('0',integer)

    when [Hours Worked] is not null then [Hours Worked]
    end

    Some will cause errors, while others will not error but not calculate (treating [Hours Worked] as 0).

    Ideas?

    Thanks, Andrew

    Filed under:
  • 09-05-2008 7:04 AM In reply to

    Re: Replace Null with Zero

    Use the coalesce function:

    coalesce([Hours Worked],0)


     

Page 1 of 1 (2 items)

Navigate: Home | Blogs | Forums | Solution Library  Get Help:  Contact | Feedback | FAQ   Terms of Use:  Terms & Conditions | Privacy Policy