Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fastest way to populate combobox with 10t+records
Message
From
08/09/2006 13:34:39
 
 
To
08/09/2006 10:45:03
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
01152310
Message ID:
01152407
Views:
29
>I have just migrated to a client-server environment with mysql as backend. However i've just encountered a problem with very slow form loading due to both slow hardware and the nature of disconnected record-sets, since i have to pull all the data from mysql to populate a combobox. I'm looking for an optimum solution in which a combobox just needs to pull just enough data (from mysql) for what is visible, like, if i may make an analogy, how vfp opens dbfs. When VFP opens a dbf, i doesn't load the entire file. Issue a use command and a table opens without delay . yet browse and you can pagedown or go to the bottom using the vertical slider. i think as you pagedown vfp fetches the corresponding data as needed from disk. I've tried asynchronous data access but it's not d same. you still have to wait till it fetches all data to be able to go to the end of the generated cursor. I mean to open a table and go to the last record, the computer just has to open the file and access first
>few and the last few records in order to emulate GO TOP, and Go bottom successfully. It doesn't have to load all data continuously (even in an asynchronous access which wastes processor time)..I've read that combobox is not suitable for large records but it's not negotiable since i was able to do it in a non-client-server environment and my client is insistent on having the incremental combobox feature.

Are the data in the combobox static? If so, you could pull all the data across into a local cursor when your app starts and leave it there, ready to be used in your form.

If not, and you have to freshly query the backend for each incremental seek, it's more challenging. Some possible strategies:

1. Re-query the backend after each keystroke. Probably slow, and likely not necessary.

2. Employ a separate text box, where the user types in the "search" string. Only after they leave that text box do you update the combo box contents. Most efficient but adds extra controls to the form.

3. Same as #1, except you implement a timer so that queries happen only if the user pauses for "x" amount of time i.e. not while they are in the middle of typing multiple characters.

None of these address the more fundamental issue of scrolling. For example, suppose by default your combobox shows the first 20 items starting with "A". If the user wants something they know starts with "B", some will just lean on the down arrow and expect it to scroll down into the "B"s, rather than typing incrementally. Unless you've loaded a big chunk of the data, you can't please these people with less than a fully-populated combobox.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform