Loading data and save memory

ysac

Member
Joined
May 25, 2003
Messages
7
Hi,

Is it possible to load only the file data of the current record into a dataset + the data of the combo boxes like postal codes, etc., and this to save memory space and to speedup loading a dataset.

An article form contains in our case about 60 fields, of which also about 10 combo boxes with their underlying data (postal codes = about 2000 codes + town names, article subgroubs about 50 codes, ...). The article file contains about 2000 articles with 60 fields.

Our purpose is to only load the data of the current record, edit the record, and then move to the next record which we load at this very moment. The data of the combo boxes and list boxes we have to load on form_load. This all to save memory.

Another file with supplier catalogues contains 50.000 records. So here the memory is even more occupied.

Thanks.
 
Ive done this before by having the SQL that selects the IDs also select the lookup value.

Suppose you have a combobox for AddressType. You main SQL query returns an AddressTypeID which you bind the combobox. You would normally then bind a lookup table of all AddressTypes to the combo. Instead, have the main query that returns AddressTypeID ALSO return AddressType (the description from the lookup table). When you go to setup your binding (or however you fill your combo), fill it with this one value.

Youll now have to figure out when the combo is first dropped down and populate it with all of the real values. You can wait til the combo is dropped down and then retrieve the values or you can load all the lookups asyncronously. When the lookups are finished loading asyncronously, fill the combos behind the scene.

Another solution that might work is to download all the lookups locally one time or include them as part of a setup. Assuming your lookups have some kind of date identifier to note when theyve been added or updated, you can have the user download the new/changed lookup values when they first log into your app. This will still mean that youll have all 50,000 records loaded into some combos, which might be slow even if reading from disk. In that case, youll need to rethink how they select that value (maybe you dont use a combobox but some kind of search mechanism).

-Nerseus
 
Back
Top