how to make a filter with more than 1 WHERE clause
how to make a filter with more than 1 WHERE clause
Hello ,
I want to make a filter to a TIBCTable as where ID=1 AND AGE=2, but this is not supported as it shows the empty dataset, my question is ¿how can i make this kind of filters?
I want to make a filter to a TIBCTable as where ID=1 AND AGE=2, but this is not supported as it shows the empty dataset, my question is ¿how can i make this kind of filters?
-
AndreyZ
Hello,
You can use such filter in the TIBCTable component. Here are two examples (using the Filter and FilterSQL properties):
the first:the second:If TIBCTable is empty after this, it means that there are no records in the table that match the filter.
You can use such filter in the TIBCTable component. Here are two examples (using the Filter and FilterSQL properties):
the first:
Code: Select all
IBCTable.TableName := 'tablename';
IBCTable.Open;
IBCTable.Filter := 'id=1 and age=2';
IBCTable.Filtered := True;Code: Select all
IBCTable.FilterSQL := 'id=1 and age=2';
IBCTable.TableName := 'tablename';
IBCTable.Open;Filters
Thanks for answering my question,
i feel that im doing something wrong becuase this:
do not show anything
Respects.
i feel that im doing something wrong becuase this:
Code: Select all
with tblClient do begin
Close;
Filtered:=False;
Filter:='id='+inttostr(id)+' AND age=2';
Filtered:=True;
Open;
end;
Respects.
Re: Filters
I have tested the query in the database and displays many records, so the table contains records definitively. I tested also with adjusting a TIBCQuery SQL property tojasmad wrote: i feel that im doing something wrong
Code: Select all
select * from client where ID=:idClient AND age=2is a component problem or definitively the Filter and FilterSQL only accept one condition ?
-
AndreyZ
-
AndreyZ
thanks
I do not use any script to fill the table, only assign values in the properties window and the table is readyAndreyZ wrote:I cannot reproduce the problem. Please specify a script to create and fill your table.
this option does not promise to me, because I work with version 0.9.31Please check if the problem persists using Lazarus 0.9.30.2.
-
AndreyZ
I need a script to create your table, something like this:Please specify a script to create your table.
Code: Select all
CREATE TABLE DEPT (
DEPTNO INTEGER PRIMARY KEY,
DNAME VARCHAR(14),
LOC VARCHAR(13)
);solved
andrey thank you very much, I could solve the problem by enclosing the terms in parentheses
and works perfectly.
respects.
Code: Select all
Filter='(id=1) and (age=2)';
respects.