Problem in Crystal report null value.

30 pts.
Tags:
Crystal Reports
Crystal Reports 2005
VB.NET 2005
Hi, I hav been facing a problem since a few days. I'm using crystal report with vb.net 2005 (.Net framework 2.0). In a report I'm retrieving the values from a database table and showing it. But the problem is that if a certain field is blank in database then it's showing a complete blank white field in the report also. This is what I don't want. For example- suppose there's a field in datbase named EntryDate which is not mandatory. So for a certain row if there's an entry for EntryDate it'll show it in the report otherwise if it's blank or null in database it'll show a user defined string in the report say 'Not Available' or something like that. For this I hav tried playing with the ZeroValueString property of the respective field in the crystal report also but of no avail. How can I solve it. Plz help with some code example. Regards.
ASKED: September 24, 2008  10:55 PM
UPDATED: April 15, 2010  5:22 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

This may not be exactly what you are looking for, but, it is not possible for you to change your query using the ISNULL function on the fields that can contains NULLS ? (I’m assuming that when you say “blank” you mean null).

If your field is of date type, you might want to change it to a character type, and convert the data in your query, using some function like CAST or DATENAME, so you can set some string as default value for nulls.

Hope this helps.

For date fields you can use something like this.

ISNULL(CONVERT(VARHCAR(10), YourField, 101), ‘Unavailable’)

For text strings you’ll do the same thing without the CONVERT function.

***********************************************************************************

How about using a formula ?

Something like this:

<pre>If isNull({someData.EntryDate}) Then
“Not Available”
Else
{someData.EntryDate}</pre>

This would work if the field is of String type. If not, the data should be converted to that type.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Priyamtheone
    Yeah you got it right. I have applied the same idea as in the last but one line. It works good. But actually I am looking for something by which I can manage it during the design time so that I wont hav to mess up the base sql query. For example there's a property in Crystal Report for text fields called ZeroValueString. Accordingly, it does the same thing. I tried to use it but couldn't figure out what'll be its proper format. Can U plz focus a bit on it. Thanks to all for ur help. Regards.
    30 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following