🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

strange problem with ADOTable filter...

#1654
From: Richard Plokhaar
Date: Tue, 09 Mar 2004 21:05
71 lines
3312 bytes
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: <404e31aa@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!in.nntp.be!newsfeed01.tsnz.net!ken-transit.news.telstra.net!ken-in.news.telstra.net!ken-spool.news.telstra.net!lon-in.news.telstra.net!news.telstra.net!mws-stat-syd.cdn.telstra.com.au!newsx!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,73b08d1388cffd8a,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-03-09 13:10:12 PST
From: "Richard Plokhaar" <richardplokhaar@hotmail.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: strange problem with ADOTable filter...
Date: Tue, 9 Mar 2004 21:05:46 -0000
Lines: 73
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: <404e31aa@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1078866346 80.42.94.6 (9 Mar 2004 13:05:46 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!in.nntp.be!newsfeed01.tsnz.net!ken-transit.news.telstra.net!ken-in.news.telstra.net!ken-spool.news.telstra.net!lon-in.news.telstra.net!news.telstra.net!mws-stat-syd.cdn.telstra.com.au!newsx!newsgroups.borland.com!not-for-mail