Subject RE: [IBO] filter problem
Author Laurent GILBERT
Hi Jason,

My program (.pas and .dfm) :

I don't how to send you directly as joined files.

Bye.

(*******************************************************************)

unit pb_ibo_2;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids, DBGrids, Db, IBDataset, IB_Components;

type
TForm1 = class(TForm)
IB_Connection1: TIB_Connection;
IB_Transaction1: TIB_Transaction;
IBOQuery1: TIBOQuery;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Declarations privees }
public
{ Declarations publiques }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
IBOQuery1.Filter := '(CUSTOMER LIKE ''%S%'') AND (TOTAL_VALUE IS NOT
NULL)';
IBOQuery1.Filtered := true;
end;

end.

(**********************************************)

object Form1: TForm1
Left = 257
Top = 255
Width = 870
Height = 640
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 120
TextHeight = 16
object DBGrid1: TDBGrid
Left = 13
Top = 88
Width = 849
Height = 225
DataSource = DataSource1
ReadOnly = True
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -13
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object Button1: TButton
Left = 288
Top = 376
Width = 75
Height = 25
Caption = 'Filter'
TabOrder = 1
OnClick = Button1Click
end
object IB_Connection1: TIB_Connection
DefaultTransaction = IB_Transaction1
LoginPrompt = True
Params.Strings = (

'PATH=c:\program files\interbase Corp\interbase\examples\employee' +
'.gdb'
'USER NAME=SYSDBA'
'PASSWORD=masterkey')
Left = 16
Top = 8
end
object IB_Transaction1: TIB_Transaction
IB_Connection = IB_Connection1
Isolation = tiConcurrency
Left = 48
Top = 8
end
object IBOQuery1: TIBOQuery
Params = <>
Active = True
DatabaseName = 'c:\program files\interbase
Corp\interbase\examples\employee.gdb'
RecordCountAccurate = True
SQL.Strings = (
'SELECT CUST_NO'
' , CUSTOMER'
' , CONTACT_FIRST'
' , CONTACT_LAST'
' , COUNTRY'
' , CURRENCY'
' , TOTAL_VALUE'
'FROM CUSTOMER'
'JOIN COUNTRY ON COUNTRY.COUNTRY = CUSTOMER.COUNTRY'
'LEFT JOIN SALES ON SALES.CUST_NO = CUSTOMER.CUST_NO')
Left = 16
Top = 48
end
object DataSource1: TDataSource
DataSet = IBOQuery1
Left = 48
Top = 48
end
end

(***************************************************************)
-----Message d'origine-----
De : Laurent GILBERT [mailto:laurent.gilbert@...]
Envoye : mer. 19 septembre 2001 08:41
A : IBObjects@yahoogroups.com
Objet : RE: [IBO] filter problem
Importance : Haute

Hi Jason,

I just make a little example with EMPLOYEE database.
On a form, I put :
* A TIB_Connection component
* A TIB_Transaction component
* A TIBOQuery component with this select statement :
SELECT CUST_NO
, CUSTOMER
, CONTACT_FIRST
, CONTACT_LAST
, COUNTRY
, CURRENCY
, TOTAL_VALUE
FROM CUSTOMER
JOIN COUNTRY ON COUNTRY.COUNTRY = CUSTOMER.COUNTRY
LEFT JOIN SALES ON SALES.CUST_NO = CUSTOMER.CUST_NO
* A TDataSource component.
* A TGrid component to display data.
* For filter 1 : A Tcheckbox and A Tedit components => '(CUSTOMER LIKE ' +
QuotedStr(Edit1.text) + ')'
* For filter 2 : A Tcheckbox => '(TOTAL_VALUE IS NOT NULL)'
* A Tlabel component to display "filter" property

When I activate separately filter 1 and filter 2 : it works.
But when I activate filter 1 and 2 together, this error occurs in
"TIBOInternalDataset.SysRefresh" function at "Result := inherited
SysRefresh( Rows, Keys );" line :
Invalid syntax: extra or missing parenthesis:
(
(
CUSTOMER IS NOT NULL
LIKE 'SIGN')
AND
(
TOTAL_VALUE)
)

A new test shows that "(TOTAL_VALUE IS NOT NULL) AND (CUSTOMER LIKE 'SIGN')"
works !!!


-----Message d'origine-----
De : Jason Wharton [mailto:jwharton@...]
Envoye : mar. 18 septembre 2001 18:33
A : IBObjects@yahoogroups.com
Objet : Re: [IBO] filter problem

For sake of saving me a little time, please put together a very simple app
that I click a button and it errors out.
I can get this fixed fairly quickly if you do this part of it.
Thanks,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: <laurent.gilbert@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, September 18, 2001 6:03 AM
Subject: [IBO] filter problem


> Hi all,
>
> In my application, I use TIBOQuery component (last 3.6 version) and
> filter property.
> My window has a grid and "filter shortcuts". When user activate
> a "filter", I modify filter property of the IBOQuery.
> Filters could be combined.
>
> Filters are :
> 1) "(TNATU_EST_CABLE = 1)"
> 2) "(TNATU_REF_TECHNO = 'O')"
> 3) "(TTEQU_NOM LIKE '%SL%')"
> 4) "(TEQU_REF_DERETATEQU > 0 AND TETATEQU_REF_SITE IS NOT NULL)"
>
> Users can select filters 1 and 2, or 1, 2 and 3, etc... It works very
> well !
>
> The only problem is when filters 3 and 4 are combined !
> The filter statement I set in filter property was : "(TTEQU_NOM
> LIKE '%SL%') AND (TEQU_REF_DERETATEQU > 0 AND TETATEQU_REF_SITE IS
> NOT NULL)".
>
> This is the IBO error that occurs :
>
> Invalid syntax : extra or missing parenthesis:
> (
> TTEQU_NOM IS NOT NULL
> LIKE '%SL%'
> )
> AND
> (
> TEQU_REF_DERETATEQU > 0
> AND
> TETATEQU_REF_SITE
> )
>
> I don't know why "is not null" was moved !
>
> If someone has an idea...
>
> Laurent.
> (PS: sorry for my poor English...)






Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/




Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/