Jump to content

filter grid


eduardosuruagy

Recommended Posts

I'm having a problem with a grid and its filter, if I have 2 related tables and the second table has no record the grid does not show the information. The select is this:

 

  SELECT P.*, LOG_BAIRRO, LOG_CEP, LOG_ENDERECO, LOG_CIDADE, LOG_UF
    FROM PROPRIETARIO P 
         LEFT JOIN LOGRADOUROS ON (PRO_LOGRADOURO_ID = LOG_CODIGO_ID) 
   WHERE PRO_EMPRESA_ID = 1
     AND PRO_RAZAO_SOCIAL LIKE :PRO_RAZAO_SOCIAL
     AND LOG_UF LIKE :LOG_UF
     AND LOG_CIDADE LIKE :LOG_CIDADE
   ORDER BY PRO_RAZAO_SOCIAL
Link to comment
Share on other sites

I already ran the select and it shows the record, as I am using the left command it shows even if it has not registered in the table "OWNER". I tried to do this command below, so the grid shows the results and the filters of the "LOG_UF" and "LOG_CITY" columns do not work.

 

SELECT P.*, LOG_BAIRRO, LOG_CEP, LOG_ENDERECO, LOG_CIDADE, LOG_UF
    FROM PROPRIETARIO P 
         LEFT JOIN LOGRADOUROS ON (PRO_LOGRADOURO_ID = LOG_CODIGO_ID) 
   WHERE PRO_EMPRESA_ID = 1
     AND PRO_RAZAO_SOCIAL LIKE :PRO_RAZAO_SOCIAL
     AND (LOG_UF LIKE :LOG_UF OR LOG_UF IS NULL)
     AND (LOG_CIDADE LIKE :LOG_CIDADE OR LOG_CIDADE IS NULL)
   ORDER BY PRO_RAZAO_SOCIAL
Link to comment
Share on other sites

First, don't use direct queries especially in SQL Server.

Create stored procedure with filtering parameters, your Delphi client will be calling it

exec sp_proc1 :PRO_RAZAO_SOCIAL, :LOG_UF, :LOG_CIDADE

 

Test in Manager Studio with some parameters and make sure it returns data, then pass the same params from Delphi. Your issue is probably caused by wrong parameters you are trying to filter with, not because of UniGui. Since you are using LIKE, maybe you forgot to prepend or append % depeding on how you want to match the data.

Link to comment
Share on other sites

First, don't use direct queries especially in SQL Server.

Create stored procedure with filtering parameters, your Delphi client will be calling it

exec sp_proc1 :PRO_RAZAO_SOCIAL, :LOG_UF, :LOG_CIDADE

 

Test in Manager Studio with some parameters and make sure it returns data, then pass the same params from Delphi. Your issue is probably caused by wrong parameters you are trying to filter with, not because of UniGui. Since you are using LIKE, maybe you forgot to prepend or append % depeding on how you want to match the data.

Open the C: \ Program Files (x86) \ FMSoft \ Framework \ uniGUI \ Demos \ Desktop \ GridFiltering project then open the database and add a new record and leave that field blank, then see that it is not shown On the grid when it runs.
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...