eduardosuruagy Posted May 13, 2017 Share Posted May 13, 2017 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 Quote Link to comment Share on other sites More sharing options...
Ario.Paxaz Posted May 13, 2017 Share Posted May 13, 2017 Hi Have you'r Select answer in Sql Server ? Best Regards. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 13, 2017 Author Share Posted May 13, 2017 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 Quote Link to comment Share on other sites More sharing options...
belo Posted May 14, 2017 Share Posted May 14, 2017 What database are you using? Firebird? Best Regards. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 15, 2017 Author Share Posted May 15, 2017 What database are you using? Firebird? Best Regards. SQL Server Quote Link to comment Share on other sites More sharing options...
rencarnacion Posted May 15, 2017 Share Posted May 15, 2017 I'm Using SQL server 2014 Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 15, 2017 Author Share Posted May 15, 2017 I'm Using SQL server 2014 Can you connect between two tables and do the dbgrid filter? Quote Link to comment Share on other sites More sharing options...
rencarnacion Posted May 15, 2017 Share Posted May 15, 2017 The Dbgrid Filter is not working in my project, that what i say it's not working to me either Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 16, 2017 Author Share Posted May 16, 2017 Can someone help me? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 16, 2017 Share Posted May 16, 2017 Hi Eduardo, Can someone help me? Please make a simple testcase for this. Best regards, Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 16, 2017 Author Share Posted May 16, 2017 I just found out and saw that if I have a column with the Null value the filter does not return anything on the grid Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 16, 2017 Author Share Posted May 16, 2017 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. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 19, 2017 Author Share Posted May 19, 2017 Can someone help me? Quote Link to comment Share on other sites More sharing options...
zilav Posted May 20, 2017 Share Posted May 20, 2017 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. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted May 20, 2017 Author Share Posted May 20, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.