This is a migrated thread and some comments may be shown as answers.

How to show all values with filter enabled

1 Answer 321 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 14 Jun 2011, 09:22 PM
I have a very simple report, that pulls from a sample database with no NULL values. I have the report working fine, and have added a parameter and a filter to filter by user name.

I would like the option of running the report for all names. I changed the "AllowNull" value to true. When I try to run the report, I get the following error:

An error has occurred while processing Report 'talksafe1':
Object cannot be cast from DBNull to other types

How do I run both filtered and unfiltered data? Again, I have no NULL values in my database, it only contains 4 records.

=Fields.Manager =  =Parameters.ManagerPrm.Value

AllowBlank = True
AllowNull = True
DataSource = SQLDatasource1
DisplayMember = Fields.Manager
ValueMember = Fields.Manager
Name = ManagerPrm
Text = Select Manager
Type = String
Visible = True

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Jun 2011, 10:13 AM
Hi Philip,

Does your database column allow nulls? We ask because the exception is usually caused due to Filtering against DBNull values. Thus our suggestion is to check filtering expressions for null values with the built-in IsNull function or directly in your query e.g. AND Manager IS NOT NULL. For example if you want to retrieve all data when null checkbox is checked, you have to change your filtering expressions as the one below:

Expression Operator Value
=Fields.Manager = =IsNull(Parameters.ManagerPrm.Value, Fields.Manager)


Kind regards,
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
Tags
General Discussions
Asked by
Philip
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or