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

Excel like Filtering: terminology of "null" or "not null" is confusing

15 Answers 202 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 01 Jun 2012, 10:46 PM
The existing terminology of "null" or "not null" is a very geeky computer science type of term and most users are caught off guard by this.  Most users in my experience would prefer the Excel "(blanks)" notation.  I like your "not null" functionality as Excel does not have this as a convenient checkbox, but again I would change the terminology to...

(blanks)
(not blank)
item 1
item 2
...

Eric

15 Answers, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
answered on 01 Jun 2012, 10:49 PM
(see attachment)

Also, I wanted to say that in this example, it's very confusing because it looks like it should only be filtering on "Blue Category".  This it is counter intuitive because both "All" and "Blue Category" are checked and the user cannot just check "Blue Category".  I know they can choose "Not Null" but again, that is not terminology users are generally familiar with.
0
Svett
Telerik team
answered on 06 Jun 2012, 09:49 AM
Hello Eric,

You can use the FilterPopupRequired event of RadGridView to customize the text of these operators:

private void radGridView1_FilterPopupRequired(object sender, Telerik.WinControls.UI.FilterPopupRequiredEventArgs e)
{
    RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
    RadItemOwnerCollection items = popup.MenuElement.Items;
    RadMenuItem operationMenuItem = items[1] as RadMenuItem;
 
    foreach (RadItem item in operationMenuItem.Items)
    {
        RadFilterOperationMenuItem compose = item as RadFilterOperationMenuItem;
 
        if (compose == null)
        {
            continue;
        }
 
        if (compose.Operator == Telerik.WinControls.Data.FilterOperator.IsNull)
        {
            compose.Text = "(blanks)";
        }
        else if (compose.Operator == Telerik.WinControls.Data.FilterOperator.IsNotNull)
        {
            compose.Text = "(no blank)";
        }
    }
}

I hope this helps.

Kind regards,
Svett
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Thorsten
Top achievements
Rank 1
answered on 26 Jul 2013, 09:27 AM
The solution don't work. It only change "Available Filters..."  submenu and not entries in the list. Any other solution? We have to localize other  list entries like "Null", "Not Null", "True", "False".

Thorsten
0
Thorsten
Top achievements
Rank 1
answered on 26 Jul 2013, 11:31 AM


The list entries"Null" and "Not Null" could be localized with following string ids.
  • RadGridStringId.FilterMenuSelectionNull
  • RadGridStringId.FilterMenuSelectionNotNull

 

Please extend product with following localization string ids.

  • RadGridStringId.FilterMenuSelectionTrue
  • RadGridStringId.FilterMenuSelectionFalse

Regards
Thorsten

 

0
Paul
Telerik team
answered on 31 Jul 2013, 10:23 AM
Hi Thorsten,

Thank you for writing.

Thank you for the suggestion. I have created a feature request in our Public Issue Tracking System. http://www.telerik.com/support/pits.aspx#/public/winforms/15467
Feel free to visit the page and add your vote/comment there. We will definitely consider putting it in our to-do list.

Please let us know if there is anything else we can be of assistance with.

Regards,
Paul
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Justin
Top achievements
Rank 1
answered on 29 May 2014, 08:47 PM
The issue seems to be more than just a matter of semantics.  Checking "null" is not the same as checking "blanks" in Excel, as it filters out only those rows which contain a truly null value, not rows that are either null or contain a blank string.  To further complicate the issue, empty string is not one of the checkboxes underneath "all."  Please correct me if I'm wrong, but it seems that there is no way to filter out rows that contain blank strings.   
0
Dimitar
Telerik team
answered on 03 Jun 2014, 01:04 PM
Hi Justin,

Thank you for writing.

Currently, to display the blank items in the filter, you can manually add item to the treeview in the filter popup. This can be done in the FilterPopupInitialized event:
void radGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
{
    RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
    if (popup != null)
    {
        popup.MenuTreeElement.DistinctListValues.Add("<empty>", "");
    }
      
}

Also we have a feature request for this in our Feedback Portal. You can track the item for status changes and add your vote for it here.

If you have any questions, please do not hesitate to contact us.
 
Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Justin
Top achievements
Rank 1
answered on 03 Jun 2014, 06:34 PM
Thanks, that worked for me.
0
Justin
Top achievements
Rank 1
answered on 16 Jun 2014, 07:04 PM
Actually, I have found that when manually adding the "<empty>" item as described above, the program will cause an unhandled exception if the user checks only the <empty> checkbox and there are no empty values in the column. 

Is there a workaround, or do I need to wait until Telerik supports the feature out of the box?
0
Dimitar
Telerik team
answered on 19 Jun 2014, 08:50 AM
Hi Justin,

Thank you for writing back.

I have tested this and when only "empty" is selected and there is no empty values in the corresponding column there is no exception. Only empty grid is displayed. In this case I want to ask you to post a support ticket for this. In it you will be able to attach a small sample that reproduces the issue and also you can specify the exact version of our suite that you are currently using.

Thank you in advance for your patience and cooperation. 

Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Justin
Top achievements
Rank 1
answered on 24 Jun 2014, 08:44 PM
Hi Dimitar,

Thanks for your reply, and I apologize for not responding sooner.  Unfortunately, I cannot send you the massive project that we are working on here, and haven't yet had time to make a small project to reproduce the issue.  The issue is not high priority for us right now, and if it becomes so I will open a support ticket. 

I can tell you this:

-After adding the code snippet exactly as described above, the <empty> item appears in the excel like filter popup
-Unchecking the <empty> item does result in all rows that contain an empty string in that column to be hidden
-Unchecking everything *except* for <empty> causes 'System.FormatException' to occur in Telerik.WinControls.GridView.dll
-The exception is thrown regardless of whether or not there are any rows containing an empty string in that column.

I don't think there is anything terribly unusual about our use of the GridView in this scenario and am surprised that you weren't able to reproduce it.  The only thing I can think of is that it is not bound to a data source.  Instead we create the columns and populate the rows entirely programmatically.

That said, if this becomes higher priority for us and I have time to make a small sample I will submit a support ticket then.

Best regards,
Justin
0
Justin
Top achievements
Rank 1
answered on 25 Jun 2014, 04:08 PM
Hi Dimitar,

I can shed some more light on the issue.  The column that this is crashing in contains an integer field which is the primary key for a record in another table.  We set the DataSource of the column to a list of objects that have fields called ContactID and ContactName.
we want to display the name of the contact even though the underlying data type is an integer.  When creating the column, we set the following properties:

column.DataSource = GetContacts();
column.ValueMember = "ContactID";
column.DisplayMember = "ContactName";

I strongly suspect that this is the problem.  Note that the excel-like filtering works fine on the ContactName text, except for the <empty> item that was manually added to the DistinctListValues. Is there a current workaround for the System.FormatException in Telerik.WinControls.GridView.dll?  If not, will this work in a future release?

Best Regards,
Justin
0
Dimitar
Telerik team
answered on 26 Jun 2014, 02:26 PM
Hello Justin,

Thank you for writing back.

In this case you cannot filter by string value since your column value is integer. And you should add a values that are compatible to the column field data type. For example you can add the the following pair to the DistinctListValues collection:
popup.MenuTreeElement.DistinctListValues.Add("<empty>", 0);

Please note that you can also add several values for a single key, which will allow you to iterate through all entries and store the integer values for the ones that does not have string values. Then you can filter by them:
popup.MenuTreeElement.DistinctListValues.Add("<empty>", new ArrayList(){21,200});

I hope this helps.

Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Justin
Top achievements
Rank 1
answered on 15 Jul 2014, 07:10 PM
Hi Dimitar,

Adding the first code snippet in your post did not work, as it caused the program to crash immediately upon clicking the filtering button. 

My question to you now is:  Would it be possible to make the textual filtering work when the DisplayMember is a string type and the ValueMember is an integer type? 

On a column that is created this way, the available filters end up being equal, not equal, greater than, less than, etc.  It seems intuitive to me as a developer that when the DisplayMember is a string type, textual filtering should work on that column using the DisplayMember and the save filters that you would see for a column with a textual ValueMember.  And as to the original post, that empty string should be one of the available checkboxes which would cover both truly null values and empty strings.

I would love to see this in a future release.

Thanks again for all your help.

Justin
0
George
Telerik team
answered on 18 Jul 2014, 02:44 PM
Hello Justin,

Thank you for replying.

In this case you can use the CustomFiltering functionality of RadGridView. This way you can add any filters you like in the DistinctListValues and filter by any property of your items. In this case you can get the value from the filter descriptors, which will actually hold the value of your items. You can find an example project attached below.

Let me know, should you have further questions.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Eric
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Svett
Telerik team
Thorsten
Top achievements
Rank 1
Paul
Telerik team
Justin
Top achievements
Rank 1
Dimitar
Telerik team
George
Telerik team
Share this question
or