🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#1469
From: Cary Letsche
Date: Mon, 28 Jun 2004 13:32
46 lines
2909 bytes
"Mark Guerrieri" <mguerrieri@cmsgrp.com> wrote in message
news:40d9f02c$1@newsgroups.borland.com...
> Can you post your exact code?  What components are you using and what
> property are assigning the filter string to?
>
> Mark
>
> "Cary Letsche" <CLetsche@agfirst.com> wrote in message
> news:40d9878d$1@newsgroups.borland.com...
> > I am having a terrible time getting the IDE to accept a Filter String
> > comparing a TDate field from IDE (dBase).  I'm using CBuilder3.0 Pro.
> > Here is basically what I want to compare:

Thanks Mark, here is the actual code:
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 >= " + (double)bdate + ") AND (EFFDATE <= " +
(double)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 + ")" ect.,
    // compiler balks about illegal use of floating point.  What gives?

}
Technical Details
Message-ID: <40e01da3@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail
References: <40d9878d$1@newsgroups.borland.com> <40d9f02c$1@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>
Subject: Re: How to create filter string to compare tdate fields in IDE (dbase) CBuilder3 Pro
Date: Mon, 28 Jun 2004 09:32:04 -0400
Lines: 49
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: 4.247.128.21
Message-ID: <40e01da3@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1088429475 4.247.128.21 (28 Jun 2004 06:31:15 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!newsfeed.iinet.net.au!newsfeed.iinet.net.au!PeerFeed.KWeb.on.ca!news.kweb.on.ca!newsgroups.borland.com!not-for-mail