-
Counting String Null Values
I am writing a Crystal Report that is counting a string value field; it will not recognize/count the null values. For example, if F2 is a server name and one field is empty, it just eliminates it from the count; I need to include it.
Any suggestions?
-
Personally I would just edit the source query to pull the field a little differently. Instead of just pulling the field "raw" I would use the Replace expression and replace null with a string saying something "Name not found" or something suitable. That should get it included in your count. Check here for more detail on the Replace function if you have not used it: http://msdn.microsoft.com/en-us/library/ms186862.aspx
Cordially,
Aaron
Keep Our Board Clean! - Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
-
Crystal uses an ODBC connection to a db table. If I add the replace function to the formula editor as you suggest I get a boolean result, which is still blank.
SELECT REPLACE({db.F3},'',"blank")
-
Hmm you shouldn't be getting a boolean result, double check your syntax your must be accidently performing a comparison. But while you are double checking, also check the documentation on Replace, and make sure it handles Nulls. The more I think about it you might actually need to be using If IsNull etc.
Cordially,
Aaron
Keep Our Board Clean! - Please Mark your thread "Solved" if you get an acceptable response (under thread tools).
- Enclose your code in VBA tags then it will be formatted as per the VBIDE to improve readability.
-
For SQL Server you can use the ISNULL() function.
For MS Access you can use the Nz() function:
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