🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1657

Re: strange problem with ADOTable filter...

#1657
From: Viatcheslav V. Vassiliev
Date: Wed, 10 Mar 2004 07:16
138 lines
5944 bytes
For filter property:

There is no precedence between AND and OR. Clauses can be grouped within
parentheses. However, you cannot group clauses joined by an OR and then join
the group to another clause with an AND, like this:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'

Date:

Date is in US format - #mm/dd/yyyy#. ADO tries to be wise and if first value
is > 12 uses #dd/mm/yyyy#.

//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Richard Plokhaar" <richardplokhaar@hotmail.com> �������/�������� � ��������
���������: news:404e35c7$1@newsgroups.borland.com...
> aarghh.... too late to work... :-(
>
> in table:
> start period 14.12.2003, end period 11.12.2004, record should show up.
> start period 14.12.2003, end period 05.01.2004, record should show up.
> start period 05.01.2004, end period 11.12.2004, record should show up.
> start period 05.01.2004, end period 10.01.2004, record should show up.
> changed line:
> start period 14.12.2003, end period 31.12.2003, record should NOT show up.
> start period 25.01.2004, end period 11.12.2004, record should NOT show up.
>
>
>
> "Richard Plokhaar" <richardplokhaar@hotmail.com> schrieb im Newsbeitrag
> news:404e33fa$1@newsgroups.borland.com...
> > and a nice typo of course...
> >
> >  in table:
> >  start period 14.12.2003, end period 11.12.2004, record should show up.
> >  start period 14.12.2003, end period 05.01.2004, record should show up.
> >  start period 05.01.2004, end period 11.12.2004, record should show up.
> >  start period 05.01.2004, end period 10.01.2004, record should show up.
> >  start period 14.12.2003, end period 31.12.2004, record should NOT show
> up.
> > <- changed line...
> >  start period 25.01.2004, end period 11.12.2004, record should NOT show
> up.
> >
> >
> > "Richard Plokhaar" <richardplokhaar@hotmail.com> schrieb im Newsbeitrag
> > news:404e31aa@newsgroups.borland.com...
> > > Hi, can somebody help me on a tiny problem?
> > >
> > > I have following problem:
> > > I have a table with a PrintOut option (text) and a "start of period"
and
> > > "end of period".
> > > the filter should show all records that have the right PrintOut field
> > string
> > > and are within the period.
> > >
> > > Example: user period = 01.01.2004 until 20.01.2004
> > >
> > > in table:
> > > start period 14.12.2003, end period 11.12.2004, record should show up.
> > > start period 14.12.2003, end period 05.01.2004, record should show up.
> > > start period 05.01.2004, end period 11.12.2004, record should show up.
> > > start period 05.01.2004, end period 10.01.2004, record should show up.
> > > start period 14.12.2003, end period 11.12.2004, record should NOT show
> up.
> > > start period 25.01.2004, end period 11.12.2004, record should NOT show
> up.
> > >
> > > in this example various pointers have been replaced to make it more
> > generic
> > > readable:
> > >
> > > -----------------------------------------------
> > > AnsiString a="01.01.2004";
> > > AnsiString e="20.01.2004";
> > > AnsiString text;
> > >
> > > ADOTable1->Filtered=false;
> > >
> > > text="( PrintOut = "+QuotedStr("SomeText");
> > >
> > > text+=" ) AND ( ( Periode_start >= '" +StrToDate(a)+"'";
> > > text+=" AND Periode_end <= '" +StrToDate(e)+"' )";
> > >
> > > text+=" OR ( Periode_start <= '" +StrToDate(a)+"'";
> > > text+=" AND Periode_end >= '" +StrToDate(e)+"' )";
> > >
> > > text+=" OR ( Periode_end >= '" +StrToDate(a)+"'";
> > > text+=" AND Periode_end <= '" +StrToDate(e)+"' )";
> > >
> > > text+=" OR ( Periode_start >= '" +StrToDate(a)+"'";
> > > text+=" AND Periode_start <= '" +StrToDate(e)+"' ) )";
> > >
> > > ADOTable1->Filter=text;
> > >
> > > ADOTable1->Filtered=true;
> > > --------------------------------------------------------
> > >
> > > so basically it is a () AND (  (()AND()) OR (()AND()) OR (() AND
))  )
> > >
> > > if I write it as () AND () AND () OR () AND () OR () AND () it is
> working
> > > right for the dates (which makes sense, but is wrong coded)
> > > if I write it as () AND (() AND () OR () AND () OR () AND ()) cpp
> builder
> > > starts to moan around that values are invalid...
> > > Can't the filter handle the nested brackets?
> > >
> > > how to solve it?
> > >
> > >
> > >
> > > -- 
> > > SIGNALSOFT Rail Consultancy Ltd.
> > > Richard Plokhaar
> > > 24 Park Road
> > > Godalming
> > > Surrey
> > > GU7 1SH
> > > United Kingdom
> > > Tel: 00 44 1483 861 320
> > > Mobile: 00 44 7867 503 908
> > > Email: signalsoft@tiscali.co.uk
> > > Private: Plokhaar@tiscali.co.uk
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <404ec0bb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <404e31aa@newsgroups.borland.com> <404e33fa$1@newsgroups.borland.com> <404e35c7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,73b08d1388cffd8a
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-03-09 23:39:26 PST
From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <404e31aa@newsgroups.borland.com> <404e33fa$1@newsgroups.borland.com> <404e35c7$1@newsgroups.borland.com>
Subject: Re: strange problem with ADOTable filter...
Date: Wed, 10 Mar 2004 10:16:05 +0300
Lines: 140
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 213.234.218.42
Message-ID: <404ec0bb$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1078902971 213.234.218.42 (9 Mar 2004 23:16:11 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail