1 (edited by amsjunior1 2023-07-09 13:16:35)

Topic: [SOLVED]is possible to make one textbox filter 2 colums

i make one exemplo but dont work

procedure Clientes_Edit_Telefone_OnChange(Sender: TObject);
var
  FilterText: string;
begin
  FilterText := Clientes.Edit_Telefone.Text;

  Clientes.TableGrid_Clientes.dbfilter := '((Telefone like "%' + FilterText + '%") or (Celular like "%' + FilterText + '%"))';
  Clientes.Btn_Buscar.Click;
end;
Post's attachments

Attachment icon filter_2_cells.jpg 27.88 kb, 39 downloads since 2023-07-05 

2 (edited by k245 2023-07-05 06:02:20)

Re: [SOLVED]is possible to make one textbox filter 2 colums

Such a filter works in conjunction with a button.

Post's attachments

Attachment icon Mask3.rar 293.29 kb, 107 downloads since 2023-07-05 

Визуальное программирование: блог и телеграм-канал.

3 (edited by k245 2023-07-05 06:04:09)

Re: [SOLVED]is possible to make one textbox filter 2 colums

Pay attention to the settings
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=9666&download=0

Post's attachments

Attachment icon search.png 40.96 kb, 35 downloads since 2023-07-05 

Визуальное программирование: блог и телеграм-канал.

4 (edited by k245 2023-07-05 06:16:36)

Re: [SOLVED]is possible to make one textbox filter 2 colums

If you need to search on two fields at the same time, then insert the search condition directly into the SQL query that is used to select the data.

http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=9667&download=0

Post's attachments

Attachment icon search2.png 61.34 kb, 36 downloads since 2023-07-05 

Визуальное программирование: блог и телеграм-канал.

Re: [SOLVED]is possible to make one textbox filter 2 colums

...

Post's attachments

Attachment icon Mask4.rar 293.44 kb, 128 downloads since 2023-07-05 

Визуальное программирование: блог и телеграм-канал.

6 (edited by sparrow 2023-07-05 13:16:54)

Re: [SOLVED]is possible to make one textbox filter 2 colums

It doesn't work like that


amsjunior1 wrote:

i make one exemplo but dont work

procedure Clientes_Edit_Telefone_OnChange(Sender: TObject);
var
  FilterText: string;
begin
  FilterText := Clientes.Edit_Telefone.Text;

  Clientes.TableGrid_Clientes.dbfilter := '((Telefone like "%' + FilterText + '%") or (Celular like "%' + FilterText + '%"))';
  Clientes.Btn_Buscar.Click;
end;

DBFilter requires a table update (.dbUpdate).
But you can remove Click.
Binding Edit to table and table fields {...} / {...} is not required. Can be cleared and the search button is not needed.
Like this.


procedure Clientes_Edit_Telefone_OnChange(Sender: TObject);
var
  FilterText: string;
begin
  FilterText := Clientes.Edit_Telefone.Text;

  Clientes.TableGrid_Clientes.dbfilter := '((Telefone like "%' + FilterText + '%") or (Celular like "%' + FilterText + '%"))';
  Clientes.TableGrid_Clientes.dbUpdate;
//  Clientes.Btn_Buscar.Click;
end;

p.s. the same for combobox in script
.dbfilter -> .dbupdate

7 (edited by amsjunior1 2023-07-09 13:19:57)

Re: [SOLVED]is possible to make one textbox filter 2 colums

thanks my friend. my project work like that perfect

procedure Clientes_Edit_Telefone_OnChange(Sender: TObject);
var
  FilterText: string;
begin
  FilterText := Clientes.Edit_Telefone.Text;

  Clientes.TableGrid_Clientes.dbfilter := '((Telefone like "%' + FilterText + '%") or (Celular like "%' + FilterText + '%"))';
  Clientes.TableGrid_Clientes.dbUpdate;
//  Clientes.Btn_Buscar.Click;

cf_telefone and cf_celular in table visible ok

telefone and celular in grid but invislbe just for search

Re: [SOLVED]is possible to make one textbox filter 2 colums

amsjunior1 wrote:

cf_telefone and cf_celular in table visible ok

telefone and celular in grid but invislbe just for search


I am very pleased that you consider me a clairvoyant, but I have to disappoint you.
I don't see what and how you have in your project on the fortune-telling cards.
Sorry