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

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;

3

(6 replies, posted in Script)

Thanks a lot for the help.

in the calculated field I added the script in this way and it worked

CONCAT('(', SUBSTR(Celular, 1, 2), ') ', SUBSTR(Celular, 3, 1), ' ', SUBSTR(Celular, 4, 4), '-', SUBSTR(Celular, 8, 4))   

thanks.

4

(6 replies, posted in Script)

i make select from mysql andwork perfect.

SELECT CONCAT('(', SUBSTR(celular, 1, 2), ') ', SUBSTR(celular, 3, 1), ' ', SUBSTR(celular, 4, 4), '-', SUBSTR(celular, 8, 4)) AS celular_formatado FROM tb_cliente;

5

(6 replies, posted in Script)

I'm trying to add maskara to the column but it's not working, follow the example below that I'm trying to apply.

TNxNumberColumn(Clientes.TableGrid_Clientes.Columns[6]).FormatMask := '!\(99\) 0 0000-0000;0;_';

OBS: database mysql

6

(2 replies, posted in Script)

thank you my friend, it worked perfect.

7

(2 replies, posted in Script)

I got an example right here on the forum very good. but i am having difficulty converting from sqllite to mysql

this is part of code.


  If Form1Button = 'Purchase Refund' then
    Begin
      //////////////////////////////////////////////////////////////////////////////////
      // Check to make sure that purchase refunds are not greater than the original purchase qty,
      //   This is checked when issuing a new refund on a purchase transaction.
      //////////////////////////////////////////////////////////////////////////////////
      PurchQtyVar := SqlExecute('Select Qty From PurchInv Where record_count = ' + Comprar_add.EditCounter1.Text + ' and id_DbCr = 3');
      TotRefundVar := SqlExecute('Select SUM(Qty) From PurchInv Where record_count = ' + Comprar_add.EditCounter1.Text
               + ' and id_DbCr = 5');

      If QtyVar + TotRefundVar > PurchQtyVar then
         Begin
            MessageBox('Refund qty will cause total refunds to be greater than the original purchase qty.','Error',MB_OK+MB_ICONERROR);
            Comprar_add.edPurchInvQty.SetFocus;
            Cancel := True;
            Exit;
         End;

error is.
could not convert variant of type (null) into type (integer)

this is line error
      TotRefundVar := SqlExecute('Select SUM(Qty) From PurchInv Where record_count = ' + Comprar_add.EditCounter1.Text
               + ' and id_DbCr = 5');

8

(7 replies, posted in Script)

undeclared indentifier TryStrToInt
sorry another error now.

procedure Clientes_Button1_OnClick(Sender: TObject; var Cancel: boolean);
var
  Logradouro, Bairro, Cidade, UF: string;
  CEP: string;
  CEPInt: integer;
begin
  // lê o valor da caixa de texto do CEP
  CEP := Clientes.edCEP.Text;

  // verifica se o valor digitado é um CEP válido
  if (Length(CEP) <> 8) or (not TryStrToInt(CEP, CEPInt)) then
  begin
    ShowMessage('CEP inválido!');
    Exit; // interrompe a execução da função
  end;

  // executa a consulta com o CEP digitado
  ConsultarCEP(IntToStr(CEPInt), Logradouro, Bairro, Cidade, UF);

  // atribui os valores retornados às caixas de texto
  Clientes.edLogradouro.Text := Logradouro;
  Clientes.edBairro.Text := Bairro;
  Clientes.edCidade.Text := Cidade;
  Clientes.edUF.Text := UF;
end;

9

(7 replies, posted in Script)

procedure Clientes_Button1_OnClick(Sender: TObject; var Cancel: boolean);
var
  Logradouro, Bairro, Cidade, UF: string;
  CEP: string;
begin
  // lê o valor da caixa de texto do CEP
  CEP := edCEP.Text;

  // verifica se o valor digitado é um CEP válido
  if (Length(CEP) <> 8) or (not TryStrToInt(CEP, CEP)) then
  begin
    ShowMessage('CEP inválido!');
    Exit; // interrompe a execução da função
  end;

  // executa a consulta com o CEP digitado
  ConsultarCEP(CEP, Logradouro, Bairro, Cidade, UF);

  // atribui os valores retornados às caixas de texto
  edLogradouro.Text := Logradouro;
  edBairro.Text := Bairro;
  edCidade.Text := Cidade;
  edUF.Text := UF;
end;

undeclared indentifier edCEP

thanks for code, but now another error.

10

(7 replies, posted in Script)

procedure ConsultarCEP(vCEP: string; var vLogradouro, vBairro, vCidade, vUF: string);
var
  vHTTP: TIdHTTP;
  vXML: TStringStream;
  vXMLDoc: TXMLDocument;
  vCEPNode, vLogradouroNode, vBairroNode, vCidadeNode, vUFNode: IXMLNode;
begin
  vHTTP := TIdHTTP.Create(nil);
  vXML := TStringStream.Create('');
  try
    vHTTP.Get('https://viacep.com.br/ws/' + vCEP + '/xml/', vXML);
    vXML.Position := 0;
    ReadXMLFile(vXMLDoc, vXML);
    vCEPNode := vXMLDoc.ChildNodes.FindNode('xmlcep');
    if Assigned(vCEPNode) then
    begin
      vLogradouroNode := vCEPNode.ChildNodes.FindNode('logradouro');
      vBairroNode := vCEPNode.ChildNodes.FindNode('bairro');
      vCidadeNode := vCEPNode.ChildNodes.FindNode('localidade');
      vUFNode := vCEPNode.ChildNodes.FindNode('uf');
      if Assigned(vLogradouroNode) then
        vLogradouro := vLogradouroNode.Text;
      if Assigned(vBairroNode) then
        vBairro := vBairroNode.Text;
      if Assigned(vCidadeNode) then
        vCidade := vCidadeNode.Text;
      if Assigned(vUFNode) then
        vUF := vUFNode.Text;
    end;
  finally
    vHTTP.Free;
    vXML.Free;
    vXMLDoc.Free;
  end;
end;


this code is correct? im try but is some error.

11

(0 replies, posted in Script)

Im need help to create

select distinct from another table.

12

(9 replies, posted in Script)

thanks work perfect

13

(9 replies, posted in Script)

I want to send some cells in tablegrid after double click to another form textbox. ths is possible?


form1.tablegrid1
cells1,cells2,cells3,cells4,cells5......

after select and double click send to another form

for

form2
textbox1, textbox2 , textbox4

14

(1 replies, posted in Script)

Form1.DateTimePicker1.DateTime := now;

it is possible to show in DateTimePicker1 the first day of the current month and in DateTimePicker2 the last day of the current month

15

(7 replies, posted in Script)

thanks work perfect

16

(7 replies, posted in Script)

It is possible to automatically calculate the total value of column6 of the tablegrid in the textbox

Tablegrid have some filters.

17

(5 replies, posted in Script)

Possible column calculated with combobox filter?


(CASE
WHEN columm1 <= 1 THEN 'Yes'
WHEN columm1 >= 0 THEN 'No'     
END)

need to place a combobox search on this calculated column without repeating equal values

18

(5 replies, posted in Script)

if Form1.TableGrid1.Cells[1,i] < 1 then Form1.TableGrid1.CellS[2,i] := 'YES';
   if Form1.TableGrid1.Cells[1,i] > 0 then Form1.TableGrid1.CellS[2,i] := 'NO';

help me convert this into a calculated field please

19

(5 replies, posted in Script)

begin
         if Form1.TableGrid1.Cells[1,i] = '1' then Form1.TableGrid1.CellS[2,i].Text := YES;
         if Form1.TableGrid1.Cells[1,i] = '0' then Form1.TableGrid1.CellS[2,i].Text := NO;
     end;


im try like this but dont work

20

(5 replies, posted in Script)

columm1 / columm2

if columm1 <=1 columm2 = yes     //  1+

if columm1 >=0 columm2= no       //   0-

please help me make this work.