Thursday, August 28, 2008

Don't FILTER Data in a Grid

I've seen several postings on the forums lately where people ask about how to FILTER data displayed in a grid. This is a very bad idea as the scroll bars and thumb don't work correctly. Look at this form, that uses a filter.




The underlying table has over 200,000 rows. I appyled SET FILTER TO Lname = "SMITH". The result is not good. Notice the postion of the thumb. When I pull the thumb to the top of the scroll bar, it jumps back to the postition shown in the screen shot because that's where the current record is based on the entire table. This is very confusing to a user.
Now look at what happens when you use a query or a view.



In this form, I set up a local view and set the grid to use the view as the data source. I then requeried the data using a View Parameter. Notice where that the thumb is located at the top of the scrollbar when the record pointer is on the first record. This is because the data for the grid only contains rows where Lname = "SMITH" rather than the entire table.

Writing applications this way may require a retraining of the users as they won't have all the data at the same time, but will always need to query the data they want. My experience shows that users prefer this type of application. YMMV.

An added bonus is that you're preparing yourself to work with SQL Server as it only uses sets of data. You always need to query for the data you want and get back only that data rather than everything.

Labels:


Comments: Post a Comment



Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]