Page 1 of 1
how to make a filter with more than 1 WHERE clause
Posted: Tue 10 Jan 2012 22:42
by jasmad
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?
Posted: Wed 11 Jan 2012 13:25
by AndreyZ
Hello,
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;
the second:
Code: Select all
IBCTable.FilterSQL := 'id=1 and age=2';
IBCTable.TableName := 'tablename';
IBCTable.Open;
If TIBCTable is empty after this, it means that there are no records in the table that match the filter.
Filters
Posted: Wed 11 Jan 2012 16:07
by jasmad
Thanks for answering my question,
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;
do not show anything
Respects.
Re: Filters
Posted: Wed 11 Jan 2012 20:13
by jasmad
jasmad wrote:
i feel that im doing something wrong
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 to
Code: Select all
select * from client where ID=:idClient AND age=2
and shows me the results of the consultation and are quite
is a component problem or definitively the Filter and FilterSQL only accept one condition ?
Posted: Thu 12 Jan 2012 09:50
by AndreyZ
I cannot reproduce the problem. Please specify the following:
- a script to create and fill your table;
- the exact version of IBDAC. You can learn it from the About sheet of TIBCConnection Editor;
- the exact version of your IDE.
info
Posted: Thu 12 Jan 2012 14:38
by jasmad
the components version is 4.0.1 for Lazarus
the table is filled at design time setting the property tablename the name of the table that i need,
IDE's version is Lazarus 0.9.31
Posted: Thu 12 Jan 2012 16:03
by AndreyZ
I cannot reproduce the problem. Please specify a script to create and fill your table.
Please note that we support only official Lazarus releases. The latest official Lazarus version is Lazarus 0.9.30.2 . Please check if the problem persists using Lazarus 0.9.30.2 .
thanks
Posted: Thu 12 Jan 2012 17:28
by jasmad
AndreyZ wrote:I cannot reproduce the problem. Please specify a script to create and fill your table.
I do not use any script to fill the table, only assign values in the properties window and the table is ready
Please check if the problem persists using Lazarus 0.9.30.2.
this option does not promise to me, because I work with version 0.9.31
Posted: Fri 13 Jan 2012 09:02
by AndreyZ
I need a script to create your table, something like this:
Code: Select all
CREATE TABLE DEPT (
DEPTNO INTEGER PRIMARY KEY,
DNAME VARCHAR(14),
LOC VARCHAR(13)
);
Please specify a script to create your table.
solved
Posted: Mon 23 Jan 2012 17:32
by jasmad
andrey thank you very much, I could solve the problem by enclosing the terms in parentheses
and works perfectly.
respects.