-
June 8th, 2010, 09:08 AM
#1
Crystal report handling null values
Hi everyone!!
This is my first post and would like to say Hello to everyone out there.
I am using embedded Crystal Report in VS2005. My problem is that i am populating the data from a table in SQL Server 2000 (for some reasons)!! Everything is working fine except that i am not able to display some text where the fields are empty or blank.
For. e.g. I have a field called TIMEIN Type (Char) with (allow nulls) value checked in sql table .
What i want is that if this field is empty it should display "ABSENT". I used the following formula but the field remians empty by right clicking the field and format object and then the icon next to Display String - guess this is the right way to do??
If Isnull({Attendance.TIMEIN}) or
instr({Attendance.TIMEIN}, "") = 0 or
UCASE({Attendance.TIMEIN}) = "" or
Trim({Attendance.TIMEIN}) = "" Then "ABSENT"
Else {Attendance.TIMEIN}
I have also CHECKED and UNCHECKED the "Convert Database Values to Default" in the ReportOptions but still no result.
I would appreciate any help!!
Cheers
irfi
-
June 9th, 2010, 07:30 AM
#2
Re: Crystal report handling null values
Try placing a space between the " ". Don't know why that works sometimes for me, but I suspect that is because our database was not very well designed, and users would use a space to delete data.
-
June 9th, 2010, 08:49 PM
#3
Re: Crystal report handling null values
In this case the best is to configure Crystal Reports
Menu / File / Option / Reporting / check Convert Database NULL values to Default
After this, all you have to do is ask for an empty string, as :
Code:
If Trim({Attendance.TIMEIN}) = "" Then "ABSENT" Else {Attendance.TIMEIN}
JG
-
June 12th, 2010, 05:19 AM
#4
Re: Crystal report handling null values
Thank you for your suggestions but unfortunately none is working for me. Just don't know whats going wrong!
-
June 17th, 2010, 01:06 AM
#5
Re: Crystal report handling null values
if not isnull({Attendance.TIMEIN}) AND trim({Attendance.TIMEIN}).length > 0 then
{Attendance.TIMEIN}
else
"ABSENT"
If this post is helpful, then, Rate this Post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|