Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Techniques for querying lookup table data.
Message
 
To
22/01/1999 14:42:29
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00179173
Message ID:
00179342
Views:
24
I use a combination of Combos and an object that I call DataStore (no relation to the PowerBuilder one).

The combos don't have a RowSource property set. I have instead 4 properties that allow me to define the database, table/view, display column and code column.

When a combo is instantiated it calls the DS with itself as a parameter: If it has never been created, the DS builds the SQL statement and checks the number of rows returned against an arbitrary cut off limit, say 300 records. If the number of records returned is less than the limit, it copies the cursor into an array otherwise it can create local indexed cursors, local views or just use an SQL statement.

What I have found is that what is really slow is the combo itself. So I have a way, at application startup, to load as many combos into the DS object as I decide.

This approach has several benefits:
Combos are created at startup (just show a nice logo...)
The DE in the forms is not cluttered with references to lookup tables
Forms load much faster (if you have a large number of combos)
Combos can be based on views without performance hits, as they can be converted to local tables or arrays. I prefer to use views rather than straightforward SQL statements as they are self documenting, both in the database and in the combo object.
Most lookup tables are small so they can be converted to arrays and just copied into each instance of a combo.

If the number of records in combos get too large, I use a different, more common, approach based on a textbox with a hidden combo in the background and activate it only for validation or in the presence of charcters like % and _ in the textbox, assigning to the combo a rowsource on the fly.

HTH

Silvio

>Does anyone have a good method of querying lookup table data in a multi-datasession environment? We've been investigating methods of querying lookup table data at application startup and saving it in order to avoid having to requery it every time we need it (for populating combo boxes and whatnot). One method we've used in the past is to query the data (using views), and copy it to global arrays. In that way, the data would be available to all datasessions. Does anyone have a better idea?
>
>Any suggestions would be appreciated.
Previous
Reply
Map
View

Click here to load this message in the networking platform