Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Display default value for null columns in crystal report

Posted on 2010-08-16
8
Medium Priority
?
795 Views
Last Modified: 2012-05-10
Hello,

We are using crystal reports to generate some PDF reports. One of the reports requires us to display a 0 [zero] in case the database column is null. This values are either returned from the database columns or calculated from formulas in sub reports.
Is there some kind of a property that needs to be set so that 0 is displayed in place of null values.
We are using the crystal report plug in for eclipse.

Thanks for your support

Best  Regards,

Prashant
0
Comment
Question by:pvasha
8 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 33452200
you may write a function in the DB to do the conversion!
0
 

Author Comment

by:pvasha
ID: 33452220
We have not writen any SQL query to get the records for the report. We have just mentioned the where clause to retrieve the records.
ksivananth: Can you please elaborate your suggestion?

Thanks,

Prashant
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 33452235
my suggestions won't work if you don't have control over SQL query, especially the select field list part!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pvasha
ID: 33452251
Yeah, we are using the crystal report designer, where we drag the columns required from the tables into the report directly.
0
 
LVL 8

Expert Comment

by:kingjely
ID: 33452269

If you dont want to do it in the Database,

In crystals,
GO TO

File> Report Options> General settings> check> Convert Database NULL values to Default> (Default for numbers is 0)

Hope this helps,

Kj
0
 
LVL 12

Accepted Solution

by:
HugoHiasl earned 750 total points
ID: 33452285
I would propose to create a crystal formula and display this one.

It could contain something like

IF IsNull({YourDBField}) THEN
  0
ELSE
  {YourDBField}
0
 
LVL 13

Expert Comment

by:PCIIain
ID: 33452453
Or set the formula editor to 'Defaults for nulls' instead of 'Exceptions for nulls' and use the formula

0+{YourDBField}
0
 

Author Closing Comment

by:pvasha
ID: 33463569
We did a null check in a formula and displayed the result of the formula.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question