Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Blank data need to show zero

edited February 2008 in General
I have a question similiar to a recent one. I want to know how to make a
DBText component to display 0 or better yet, $0.00 when there is no value.
Actually the value is null.
I am using an aggregatge query where I query the sum of Debits and sum of
Credits grouped by account. The results will be a situation where the
record returns something like the following:
Account: 11200
Debits: $500.00
Credits: Null

The SQL behaviour is such that it returns null. We obviously have to
display the line because it had debits but no credits. Therefore it is not a
no data behavior issue but rather a null value issue.

I realize I can solve with a variable component but that adds code and I
have this issue a lot.
I am sure there is a simple way to tell it to display 0 on numeric fields
when they are null.
Your help is appreciated.
Thanks,
Bob

Comments

  • edited February 2008
    Hi Bob,

    Try using the OnGetText event to check the value of the datafield and set
    the text of the DBText object accordingly. For instance if the field value
    is null, simply set the text parameter to '$0.00'.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2008
    A "ZeroWhenBlank" option in addition to the existing "BlankWhenZero" would
    save a lot of people a lot of unnecessarily wasted time coding and
    debugging! Not complaining just suggesting...

    Branden Johnson

  • edited February 2008
    My thoughts as well. A variable will do it but the Zero when blank would be
    great.
    Just a suggestion to an already great product.
    Thanks
    Bob

This discussion has been closed.