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

Ok, it works.

Very great job....

Regards.

Laurent.

-----Message d'origine-----
De : Jason Wharton [mailto:jwharton@...]
Envoye : mer. 19 septembre 2001 20:09
A : IBObjects@yahoogroups.com
Objet : Re: [IBO] filter problem

I've located and fixed the problem.

I will patch both 3.x and 4.x.

(Since it appears you are still on 3.x)

Here is the code change in IB_Parse.pas:

function GetRelOps( var AText: string ): string;
var
ii: integer;
tmpPos1: integer;
tmpPos2: integer;
tmpPos3: integer;
begin
Result := '';
if contains_relational_ops( Copy( Trim( AText ), 1, 3 )) then
begin
ii := rel_op_pos( AText );
if Trim( Copy( AText, 1, ii - 1 )) <> '' then
Exit;
repeat
ii := rel_op_pos( AText );
if (ii > 0) and ( Length( Result ) < 2 ) then
begin
if Result <> AText[ii] then
Result := Result + AText[ii];
Delete( AText, ii, 1 );
if ii <> rel_op_pos( AText ) then
Break;
end;
until ( ii = 0 ) or ( Length( Result ) = 2 );
end
else
begin
tmpPos1 := getLitSafeStrPos( 'IS ', UpperCase( AText ), 1 );
if tmpPos1 > 0 then
begin
tmpPos2 := getLitSafeStrPos( ' NULL', UpperCase( AText ), 1 );
if tmpPos2 > tmpPos1 then
begin
tmpPos3 := getLitSafeStrPos( ' NOT ', UpperCase( AText ), 1 );
if ( tmpPos3 > tmpPos1 ) and ( tmpPos2 > tmpPos3 ) then
Result := 'IS NOT NULL'
else
Result := 'IS NULL';
if Trim( Copy( AText, 1, tmpPos1 - 1 )) = '' then
Delete( AText, tmpPos1, tmpPos2 - tmpPos1 + 5 )
else
Result := '';
end;
end;
end;
end;

Just replace the existing implementation of this routine with this one.

Regards,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Laurent GILBERT" <laurent.gilbert@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, September 18, 2001 11:41 PM
Subject: RE: [IBO] filter problem


> 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/
>
>




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