Telerik blogs

This post might seem like a no brainer, but I've received quite a few inquiries on this matter recently, so decided to post here. 

Let's say you have a parameter of Type: DateTime with AllowNull: true and we filter on a field based on the input parameter value i.e.:

Expression        Operator      Value
===========   ========  =================================

=Fields.MyField        =            =Parameters.MyParam

When we tick the 'null' checkbox, it basically filters the report to find the Fields with Nulls. However one might expect that it just won't filter at all with this setup. And indeed if you do not wish to filter, you should not have to. Then how do you handle "empty/blank" values in such cases and display all rows?

This is all very easy by changing properly the expression in the filter:

Expression        Operator      Value
===========   ========  =================================


=Fields.MyField        =            =IsNull(Parameters.MyParam, Fields.MyField)

For report parameters of type String you can use the AllowBlank property, which determines if the editor allows an empty string to be entered. Note that it is taken into account only for parameters of type String, because there is no such thing as "empty" datetime, integer, boolean etc.

Hope this helps!


About the Author

Stefan Tsokev

Stefan’s main interests outside the .NET domain include rock music, playing the guitar and swimming.

Related Posts

Comments

Comments are disabled in preview mode.