I am trying to write a simple report with one parameter. The data field that I am using as a parameter, contains Null values. When I try to run the report, I get the error: An error has occured while processing Report": Object cannot be cast from DBNull to other types.
The field column is a date field.
If I remove the parameter, the report works. How do I get around the Null values?
This is a class in a VB.Net project, not an ASP.Net page.
The field column is a date field.
If I remove the parameter, the report works. How do I get around the Null values?
This is a class in a VB.Net project, not an ASP.Net page.
7 Answers, 1 is accepted
0
Hi Philip,
Peter
the Telerik team
Unfortunately we cannot reproduce the problem you are experiencing. DBNull.Value seems to be handled correctly in our tests no matter what we try. Could you please send us a small runnable sample report that reproduces the problem so we can diagnose what causes the error messages you receive. Any additional feedback from you in this regard will be greatly appreciated.
In the meantime you can check for Null values with an IsNull function:
= IsNull(Fields.Column4,"Null Text")
Peter
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Rupinder Mann
Top achievements
Rank 1
answered on 23 Jul 2010, 05:05 PM
I am experiencing a similar issue. I had created reports as a separate project using older version of Reporting tools. Then I referenced these reports in the web application. The SQL data in the reports had several fields with null values and it all worked fine until I upgraded to latest version of Telerik controls, Q1 2010 (4.0.10.423). Now when I generate reports, and use a particular field (with null values in it) as a filter it produces an error: "Object cannot be cast from DBNull to other types."
I noticed if I remove those null values, the reports work fine.
It makes me wonder if there is any property in the telerik reporting tools which needs to be set to accept nulls. Since it was working with the older version, perhaps it was set to accept null values in the older version as default.
I can use IsNull function but would rather not if there is a way. Please advice.
I noticed if I remove those null values, the reports work fine.
It makes me wonder if there is any property in the telerik reporting tools which needs to be set to accept nulls. Since it was working with the older version, perhaps it was set to accept null values in the older version as default.
I can use IsNull function but would rather not if there is a way. Please advice.
0
Hello Rupinder,
As my colleague mentioned, we cannot reproduce the problem you've reported in our local test. Please send us a runnable sample report that exhibits the problem. Once we review it, we would be able to provide you with more info.
Best wishes,
Steve
the Telerik team
As my colleague mentioned, we cannot reproduce the problem you've reported in our local test. Please send us a runnable sample report that exhibits the problem. Once we review it, we would be able to provide you with more info.
Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 05 Aug 2010, 12:49 AM
I'm getting this with the latest release as well...
My data is created in NeedsDataSource, its a openaccess object mapped to a view
All works okay except when I try and put a filter on that column with a Null Value
Filter expression is
=Fields.Status Like =IsNull("%" + Parameters.Status + "%", Fields.Status)
If I remove the filter, report generates
Problem field in the View is a Varchar(50) null
My data is created in NeedsDataSource, its a openaccess object mapped to a view
All works okay except when I try and put a filter on that column with a Null Value
Filter expression is
=Fields.Status Like =IsNull("%" + Parameters.Status + "%", Fields.Status)
If I remove the filter, report generates
Problem field in the View is a Varchar(50) null
0
Hi Steve,
I guess this is the Status field that can have null values. If this is the case I would suggest to avoid comparing null values with LIKE operator. So the filter can be modified like this:
=ISNULL(Fields.Status, "aaa") LIKE =ISNULL("%" + Parameters.Status + "%", ISNULL(Fields.Status, "aaa"))
Greetings,
Svetoslav
the Telerik team
I guess this is the Status field that can have null values. If this is the case I would suggest to avoid comparing null values with LIKE operator. So the filter can be modified like this:
=ISNULL(Fields.Status, "aaa") LIKE =ISNULL("%" + Parameters.Status + "%", ISNULL(Fields.Status, "aaa"))
Greetings,
Svetoslav
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Mex
Top achievements
Rank 1
answered on 17 Mar 2011, 03:50 PM
Any solution to the above problem, am facing the same problem. I keep on receiving; an error has occurred while processing report '': Object cannot be cast from DBNull to other type, when i try to preview report after editing null value in the database..please help me out.
0
Adam
Top achievements
Rank 1
answered on 06 Oct 2011, 05:45 PM
I was having the same problem and Svetoslavs answer helped.
Expression Operator Value
=ISNULL(Fields.Status, "aaa") LIKE =ISNULL("%" + Parameters.Status + "%",
ISNULL(Fields.Status, "aaa"))
In this way, whenever a field is Null, and the parameter is NULL, it will be comparing "aaa" with "aaa". Beautiful.
Expression Operator Value
=ISNULL(Fields.Status, "aaa") LIKE =ISNULL("%" + Parameters.Status + "%",
ISNULL(Fields.Status, "aaa"))
In this way, whenever a field is Null, and the parameter is NULL, it will be comparing "aaa" with "aaa". Beautiful.