🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to create filter string to compare tdate fields in IDE (dbase) CBuilder3 Pro

#1472
From: Cary Letsche
Date: Mon, 28 Jun 2004 20:57
37 lines
2577 bytes
I made a mistake in the sample code I sent.  It should look like this:

void __fastcall TMainForm::DateRptButtonClick(TObject *Sender)
{
    String filterstr;
    TDate bdate,edate; // variables to hold TDate data

    GetDateForm->ShowModal(); // get the dates from the user
    // Convert the String Dates into TDate memory variables
    bdate = (double)StrToDate(GetDateForm->fBdate->Text);
    edate = (double)StrToDate(GetDateForm->fEdate->Text);

    // Now we have everything, put the filter string together
    // EFFDATE is a TDate Field in my dBase table
    // It would normally be accessed with Data->LatsEFFDATE->Value,
    // but not here

    filterstr = "(EFFDATE >= " +  bdate + ") AND (EFFDATE <= " + edate +
")";
    // Actual string looks like "(EFFDATE >= 01/01/2004) AND (EFFDATE <=
01/31/2004)"

    Data->Lats->Active = false; // turn off the table
    Data->Lats->IndexName = "EFFDATE"; // Set the Index to EFFDATE order
    Data->Lats->Filter = filterstr; // assign the string above
    Data->Lats->Filtered = true; // turn on filtering
    Data->Lats->Active = true; // turn the table back on

    // Compiles but get the following error: Invalid Fileter Expression
    // Character, "/"
    // If I use the expression "EFFDATE >= " + (double)bdate + ")" etc.
(below)
   // filterstr = "(EFFDATE >= " +  (double) bdate + ") AND (EFFDATE <= " +
(double) edate + ")";
   // the compiler balks about illegal use of floating point.  What gives?

}
Technical Details
Message-ID: <40e08614$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40d9878d$1@newsgroups.borland.com> <40d9f02c$1@newsgroups.borland.com> <40e01da3@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,97c87519e26c8efb
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
Reply-To: "Cary Letsche" <CLetsche@agfirst.com>
From: "Cary Letsche" <CLetsche@agfirst.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <40d9878d$1@newsgroups.borland.com> <40d9f02c$1@newsgroups.borland.com> <40e01da3@newsgroups.borland.com>
Subject: Re: How to create filter string to compare tdate fields in IDE (dbase) CBuilder3 Pro
Date: Mon, 28 Jun 2004 16:57:41 -0400
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 68.152.9.254
Message-ID: <40e08614$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088456212 68.152.9.254 (28 Jun 2004 13:56:52 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail