Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to handle lookup
Message
De
14/11/1997 10:39:38
 
 
À
14/11/1997 06:23:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00059917
Message ID:
00060262
Vues:
28
>>>>>>>>>Hi, I'm new to VFP (3.0b) and am hoping you will be able to help me with some ideas on the best way (user-interface wise) to lookup an indivual in a database. I have a database of 12,000 Alumni, and users need to lookup Alumni from the database useing one of several search criteria (lname, grad date, City, ID#, Company, etc). The initial search could produce multiple individuals (ex. lname="Brown" could produce 40+ Alumni) from which I would like the user to be able to select one. I would then display full Alumni information for the selected Alumni.
>>>>>>>>> My thought was to have a listbox holding the initial search criteria (lname, grad date, City, ID#, Company, etc.) and a textbox for the user to enter (for instance) the last name. When the user clicks on a FIND button, I would search the database, fill an array with the results, and bring up another listbox based on the array. The user would make his/her final selection here.
>>>>>>>>> Does this seem like the 'right' way to do it? Any other thoughts? Thanks in advance,
>>>>>>>>>
>>>>>>>>>Dave DeHaan
>>>>>>>>
>>>>>>>>Dave,
>>>>>>>>
>>>>>>>>There are many, many ways to find a record. Each one as individual as the programmer who created it. The 'best' way is really a matter of personal preference.
>>>>>>>>
>>>>>>>>One way that I've used lately seems to work pretty well.
>>>>>>>>
>>>>>>>>Using the same form that you use for data entry, create a 'search mode' so that the user can enter information into any of the available fields. When they press 'OK' (or 'GO' or whatever), a filter is set on the file to show only those records that contain the information entered. In your case, LName, City, etc.
>>>>>>>>
>>>>>>>>Since this is a relatively small table, the filter should not slow the system significantly.
>>>>>>>>
>>>>>>>>My users seem to like this method. Perhaps yours will too.
>>>>>>>
>>>>>>>Thanks Larry (and Eric),
>>>>>>> You have both given me some good ideas. When I said 'right', I probably should have said 'clean' or 'non-kludge'. Haveing one listbox bring up another seemed kind of cumbersome to me! I will look into implementing a search mode form that brings up a grid showing filtered records based on the user input.Using the column headers to re-order the records also appeals to me.
>>>
>>>>>>> I just want to make sure there won't be any significant performance issues using a grid on a filtered table of 12,000 records. Everything I have read so far (not all that much!) seems to indicate this should not cause too much of a problem... Thoughts?
>>>>>>>Thanks,
>>>>>>>Dave DeHaan
>>>>>>
>>>>>>I try to stay away from filtering tables in my forms because of performance. If you activate a filter on a table and also have an index set on the table, things can get pretty slow, depending on the complexity of the filter. I prefer to base all the controls on the form on a cursor, and when the user enters criteria, requery the underlying table. Whether or not you use filters or not, you want to be sure and have indexes on every field that the user can query on and on deleted().
>>>>>
>>>>>So the table is tied to the form, and the cursor is tied to the grid or listbox or whatever, right? The cursor is created interactively based on the users search criteria, right? So, if using a listbox (for example), I would set its RowSource property to the Cursorname and its RowSourceType to 6 (Fields)?
>>>>>Thanks again,
>>>>>Dave DeHaan
>>>>
>>>>If you are using the listbox to allow the user to choose a field to query on, then you would set the Rowsource type to structure. (This lists the names of the fields in the given table.)
>>>>Another hint, instead of a listbox to allow the user to pick an alumnus from the available (filtered, or whatever) alumni, you should use a grid. List boxes start to break down and show their weaknesses when asked to display more than a couple hundred records.
>>>
>>>Thanks Eric (and Jeff) for your replies. Your comments about what controls to use based on my particular situation is much appreciated! I've decided to use a series of text boxes situated next to some labels (Last Name, Grad Date, City, etc.). I will SELECT into a cursor for those textboxes that are filled in. The cursor will be tied to a grid.
>>> I'm now a little confused about how to create (initialize) the cursor and tie it into the grid. I've been looking at VFP help files and am just getting confused. Is there a specific place I can look for help on this issue or do you have some basic information you could impart? (I told you I was new...)
>>>Thanks,
>>>Dave DeHaan
>>
>>Basic idea is simple enough. When the cursor (e.g. 'tmpSearch') is ready, you issue:
>>Thisform.Grid1.Recordsource="tmpSearch"
>>Thisform.Grid1.Refresh
>
>Ed,
> I have the above coded in the 'search' button click event (along with a SQL SELECT that creates the cursor) but now seem to be having a scoping problem. When I issue the above code, the grid is populated, but when I click on the grid, everything disapears. It appears the cursor is local to the button click event code. What am I missing? How can I make the cursor accessible to the button click event and the grid? I hope I am asking the right questions!
>Dave

Ooops, I found my problem in some bogus code I had put into the grid. Thanks for all your help!
Dave
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform