Subject Re: [IBO] incremental search without fetching too many rows
Author mmenaz
--- In IBObjects@y..., Geoff Worboys (TeamIBO) <geoff@t...> wrote:
> > Hi, I've to provide the user the possibility of starting write the
> > name of the customers and having the matching rows displayed in a
> > grid for selection.
>
> This sounds a lot like TIB_LookupCombo :-) Perhaps you could just set
> AutoDropDown to true to achieve the desired effect?

I'm not working on a lookup dataset, just a normal dataset from which, pressing a button, the user "takes" some record to be put into another dataset. So, as far as I understand, TIB_LookupCombo is not good.

>
>
> > Now it's working with a IB_Query and a IB_IncSearch. The problem is
> > that this way I have to open the IB_Query that has a select like
> > "select * from customers" and only after the user is entering some
> > values in the IB_IncSearch there is a refinement in the dataset.
>
> I am not sure you can get exactly what you are looking for this way,
> since I dont think IB_IncSearch is not hooked up to work exactly as
> you want.
>
> One option that comes to mind is the use of the ParamName feature of
> TIB_Edit (although this wont automatically follow the dataset
> ordering like IncSearch). A quick experiement that I just did...
>
> SELECT * FROM EMPLOYEE
> WHERE LAST_NAME STARTING WITH :LAST_NAME_INPUT
>
> Setup TIB_Edit with no DataField assigned, instead assign ParamName to
> LAST_NAME_INPUT. Now your grid will show nothing until a parameter
> value is entered.
>
> Enter a value 'Be' into the edit control and tab out of the control
> and the grid will show two records. For the moment, to get things
> working smoothly, you will probably want to attach code to the control
> so that:
>
> procedure TForm1.IB_Edit1KeyUp(Sender: TObject; var Key: Word;
> Shift: TShiftState);
> begin
> // on return force the parameter to be updated
> if Key = VK_RETURN then
> IB_Query1.UpdateData;
> end;
>
> Eventually I want to make this capability more automatic (since I need
> it for some of my own apps).
>
> Does this do what you want?

Sounds good, with some more tuning. I.e. I could intercept the onkeypress event and have the update done at every keypress (like lookup does), maybe doing it only if the text is longer than 3 chars to avoid unuseful search.
But, what about having some standard component/setups behave the way I (we?) need? The famous IB_IncSearch maybe? C/S friendliness is one of the bigger strength of IBO...
Regards
Marco Menardi