[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1722
  • Last Modified:

How do I default the null field to zero?

I have summary calculations involving different fields which are sometimes null values. How do I handle those null values and default them to zero in crystal reports.?

Isnull function does check for the null value but is there any built in function like NVL in crystal to do the same functionality as defaulting the field to zero.

Thanks in advance!

~nat
0
asnath
Asked:
asnath
  • 4
  • 4
3 Solutions
 
bdreed35Commented:
Under the File menu, Report Options.
You have 2 options to Convert Nulls there, Database values and/or Other values.
0
 
wykabryanCommented:
There are a few of place that you can do this.
1. Using a view, put a check in on number fields - isnull(column, 0) as columnname
2. In the area the bdreed35 stated
3. Right click on the column in the report, go to format field.  
   Click on Customize, and go to Show Zero Values as

Using any combination of these will ensure that no nulls are displayed.
0
 
asnathAuthor Commented:
If I want to convert the null values to zero value....how do i do there in the report options.?

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
wykabryanCommented:
Goto File > Report Option>
In there, it should read something like "Convert database NuLL values to default" and "Convert Other Null Values to Default"

If you want to apply this to all reports:
Goto File>Options> Reporting Tab>
In there, you should see under that Reading Data section, "Convert other NULL Values to Default"
0
 
asnathAuthor Commented:
But I am doing summary of many of these fields this change in the Report options will not work for the real calculations ...is that correct?

If I want to add column1+column2 +column3 + column4+ column5 ....................

In this calculation any one of the field maybe null anytime......so how do i handle this null problem in this summary calculation.
0
 
wykabryanCommented:
By setting the defaults and other options, it should take care of this issue.  If it does, adding the isnull function around every column will convert it all over for you.

isnull(column1,0)+isnull(column2,0) +isnull(column3,0) + isnull(column4,0)+ isnull(column5,0)
0
 
asnathAuthor Commented:
If I do isnull(column1,0)
It says
Too many functions have been given to this function.

What could be wrong with this?
0
 
wykabryanCommented:
local numbervar column1:= if isnull([column1name]) then 0 else [column1name];
local numbervar column2:= if isnull([column2name]) then 0 else [column2name];
ect.

column1+column2


Oops, sql server coding coming out.  You actually have to set the values to zero if null.
0
 
asnathAuthor Commented:
bdreed35 and wykabryan ....
Thank you very much for you help!

~nat
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now