CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old March 24th, 2004, 05:38 AM
    Stijn Stijn is offline
    Junior Member
     
    Join Date: Mar 2004
    Posts: 2
    Stijn is an unknown quantity at this point (<10)
    Unhappy Calculating the average of running total fields: empty result

    I want to calculate the average of 12 running total fields. Some totals fields are empty.

    If I calculate the average when one of the total fields is empty, the result is also empty.

    The average is only calculated when the 12 running total fields aren't empty.

    Does someone knows what I have to do?
    Reply With Quote
      #2    
    Old March 24th, 2004, 09:35 AM
    malleyo malleyo is offline
    Member +
     
    Join Date: Jul 2003
    Location: Florida
    Posts: 651
    malleyo has a spectacular aura about (125+)malleyo has a spectacular aura about (125+)
    Instead of an empty field, could you populate it with a 0? Or when you do your average, maybe you could use some kind of If statement to change Empty fields into zeros (If value is NULL Then value = 0). I don't know what the correct syntax for that would be in Crystal Reports though.
    __________________
    I'd rather be wakeboarding...
    Reply With Quote
      #3    
    Old March 25th, 2004, 02:38 AM
    Stijn Stijn is offline
    Junior Member
     
    Join Date: Mar 2004
    Posts: 2
    Stijn is an unknown quantity at this point (<10)
    Thanks for the advice. I found a statement which replaces the empty fields with a zero. It's like this:

    average (
    [if not isnull({#field1}) then ({#field1}) else 0,
    if not isnull({#field2}) then ({#field2}) else 0,
    if not isnull({#field3}) then ({#field3}) else 0,
    ...]
    )
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:55 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009