Article View: borland.public.cppbuilder.database.ado
Article #1655Re: strange problem with ADOTable filter...
From: Richard Plokhaar
Date: Tue, 09 Mar 2004 21:15
Date: Tue, 09 Mar 2004 21:15
89 lines
4091 bytes
4091 bytes
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:
<404e33fa$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!hermes.visi.com!news.octanews.net!priapus.visi.com!orange.octanews.net!news-out.visi.com!petbe.visi.com!news.octanews.net!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<404e31aa@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,73b08d1388cffd8a X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-03-09 13:19:38 PST From: "Richard Plokhaar" <richardplokhaar@hotmail.com> Newsgroups: borland.public.cppbuilder.database.ado References: <404e31aa@newsgroups.borland.com> Subject: Re: strange problem with ADOTable filter... Date: Tue, 9 Mar 2004 21:15:31 -0000 Lines: 91 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: 80.42.94.6 Message-ID: <404e33fa$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1078866938 80.42.94.6 (9 Mar 2004 13:15:38 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!hermes.visi.com!news.octanews.net!priapus.visi.com!orange.octanews.net!news-out.visi.com!petbe.visi.com!news.octanews.net!news-out1.nntp.be!propagator2-sterling!news-in.nuthinbutnews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail