Search Grid Data Input

More advanced topics discussed.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Larry TIetz

Search Grid Data Input

Post by Larry TIetz »

I am using a search box connected to a grid. The search entry will take me to the correct place on the grid (actually I read the line and set curfld), however, after making an entry, the grid view reverts to the "old" view upon exiting the cell. The view was set to sort on the column the search was related to, and now is back to the original.

Anybody know how to capture the data and move along the row?
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

Until we have the ability to query the grid for the last column that was sorted and the heirarchy of sorts before that we will be unable to move along a row of a sorted grid because as soon as you exit the grid it gets resorted to its original status.

If you presort the arrays before populating the grid and then do a forced sort on an already sorted column the search box will work and the curfld movement of the cursor will work. If you shut off the sorting of a column then you will not be able to search in that column for an item.

I think you are starting to realize why I do my own grid search without the searh-box.

George
Larry TIetz

Post by Larry TIetz »

But if I have the row that I want, can't I redirect the cursor back to that row after the grid refreshes in the previous display

Maybe i should refresh first, then goto row?
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

If you refresh the grid to its original sequence and do not use a curfld to position the cursor, but return to an input fields in the resequenced grid the cursor should still be on the field that you had chosen. Now that the grid is resequnced to its "natural" order you should be able to start moving the cursor with curfld and not be subjected to the grid rearranging itself anymore. You can resequence the grid by doing an add (+) with empty arrays (DIMed zero).

Also, if you capture the currow with an input fields statement that row number should be the row number of the natural order, not the sorted order. So in that case you could use curfld to start moving your curosr in the resequneced grid. The grid will reseuence as soon as you exit and re-enter. This may confuse your users a little. (or a lot).

George
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: Search Grid Data Input

Post by Gabriel »

I think the best approach with grids is to use the search box and do as little artificial processing as possible, allowing BR Grids to work naturally the way they naturally work. With a little training, your users will soon learn to be masters of the BR grid, and BR handles all the complicated sorting logic for you - so you don't need to do anything else except give them a grid and a search box and let them go to town.

If you teach them to sort the various columns on their own when they want to change the column that they are searching in, they will find they can access the information any way they need to, and you don't even have to write any specialized logic for sorting in your various columns.


In my experience working with grids, I found that when I combined standard grids with my own custom search logic, I ran into a lot of problems. Today, I would choose to either write my own logic entirely, or to rely on BR's default grid and search box handling - and you may find that BR's default grid and search box handling works better then you might initially expect, in giving the end user the power and flexibility they need to efficiently navigate the grid to the specific entry they need.


For example, right now in your grid you have a UBC code search, that allows the user to enter a UBC code and then looks in a hidden reference array to find the item number. It inputs the UBC code you're searching for with a standard RINPUT FIELDS statement, and then it searches using the BR SRCH function to find the item number, and finally it uses CURFLD to set the cursor to the row in the grid for that item. This is all custom search logic that you had to write individually for the UBC code column.

Instead of having a custom routine for the UBC code and another custom routine for each of your other search fields individually, consider displaying the UBC code and simply allowing the user to click on the UBC code column heading when they are trying to search by UBC code. In the long run this works much better because once they understand how the functionality applies to one grid in your program, they are able to use the same technique in all your BR grids.

Gabriel

Larry TIetz wrote:I am using a search box connected to a grid. The search entry will take me to the correct place on the grid (actually I read the line and set curfld), however, after making an entry, the grid view reverts to the "old" view upon exiting the cell. The view was set to sort on the column the search was related to, and now is back to the original.

Anybody know how to capture the data and move along the row?
Post Reply