DBLookUpComboBox catch all values from table lazarus / 16-Databases ---------------------------------------------------------------------- bambamns · 2012-08-29 01:04 Hi , Is it possible to turn off DBLookUpComboBox to catch all data from ListSource table ? I have a table with few thousand records and user have to have an option to chose one value from one field. DBLookUpComboBox provide a good solution for purpose I need, but it slows down SQLQuery opening , cause it reads (catch) all data from table. Of course, user have another option to use , with complete new window with DBGrid and some filters, but in initial window it is important to let him chose an value from DBLookUpComboBox. Thx ---------------------------------------------------------------------- goodname · 2012-08-29 02:45 You could have some radio buttons that have options "a-d", "e-g", ...,"w-z". After a option is selected add a serverfilter and reopen the query. SQLqry.serverFilter:=" fld like 'a%' OR fld like 'b%' "; The old stable release 0.9.30 needed a reopen of the query to re- populate the combobox list. The new 1.0 release may just need a refresh. Have not tried it. ---------------------------------------------------------------------- bambamns · 2012-08-29 02:52 Thx goodname, But this is not an solution I'm looking for. The DBLookupComboBox is component I'm using in all other forms for same purpose , so the user can have an universal interface for all the data it has to chose or fill in. Your solution is one of workarounds but not suitable for me. Thx again. ---------------------------------------------------------------------- ludob · 2012-08-29 06:30 I don't completely understand what your problem is. The listsource has too many unused values and you want to display only values used in the DataSource? Use a join in the query for ListSource so that only used values are listed. If the user has to be able to choose among 1000 values you need to load the 1000 values. If not, adapt the query for the ListSource to display the values to be displayed. Or are you talking about loading say 50 values and only fetch the next 50 values if the user scrolls completely down in the DBLookUpComboBox? ---------------------------------------------------------------------- bambamns · 2012-08-29 13:06 Quoteare you talking about loading say 50 values and only fetch the next 50 values if the user scrolls completely down in the DBLookUpComboBox? Yes, that is what I'm trying to achieve. ---------------------------------------------------------------------- Knipfty · 2012-08-29 13:47 Hi bambamns, I too am trying to understand this request.  You have a DBLookUpComboBox on a form and by default, it loads the entire table of values which in total is about 3000 lines.  Does the user scroll down the list looking for a value?  Or do they begin typing and the DBLookUpComboBox moves to teh correct entry? If you are looking to have the DBLookUpComboBox only bring in chunks as needed, the user would see the delay each time a chunk of data was needed.  If you really need that much data in this control, I would optimize the table making it as narrow as possible.  Then I would put a clustered index on the field you are loading forcing the table to be in the order you disire (also improving load time). IMHO, thousands of items in a DBLookUpComboBox is way too much, you may have to rethink the user interface to come up with a better method.  I'm not sure exactly what that would look like, but I am pretty sure something could be done. Given what you already have, you delay will either be at the start or during the selection process as you read chunks of data. ---------------------------------------------------------------------- ludob · 2012-08-29 13:56 The DBLookUpComboBox is meant to display/edit the value of a field in a datasource based on the lookup values in a separate ListSource. What you are trying to do is use a ComboBox to display values in a table. DBLookUpComboBox loads all values in ListSource for several reasons. The lookup is done with a key value and all key values need to be know before you can do a lookup. When scrolling in the datasource, updating the lookup value has to be immediate meaning that they have to be already in memory. The only solution I see is to use a standard ComboBox and fill the items from a TSQLQuery. You can use the OnSelect handler to load the data as needed and using a small PacketRecords property value (default 10) you'll fetch data in small blocks from the db.  You'll have some problems to solve when you want to use AutoComplete (searching values as you type the first letters). ---------------------------------------------------------------------- bambamns · 2012-09-07 15:30 Thx for all the answers, As I can notice, DBLookUpComboBox has a different approach from DBGrid as data loading is concers (I'm using Lazarus for at least a two years - yeah -  and I forgot how it is on Delphi, but I can not remember this was a isue with Delphi DBLookUpComboBox). DBGrid loads a several lines (data from database), as long it need to display and after user scroll down it reads more from databese (as long TSQLQuery parametar PacektREcord is different from -1). Ok, my thought was, thare is some method or propertie in DBLoolUpComboBox to change this kind of behavior, but as I can read from answers it is not a option. Thank you, once again.