Board index » delphi » Nuts Over Filter Statement!!

Nuts Over Filter Statement!!

Hi:

Newbie here.  I'm trynig to filter a dataset, but everytime I run the app,
the BDE returns with an error.  Something like "Arithmetic Function Not
Supported", huh?  Below is the code to set the filter.  Thanks in advance.

procedure TfCheckIn.FormActivate(Sender: TObject);
begin
DatePicker.Date := Date;
myFilter := '(Show <> True) and (ShowDate = > ' + DateToStr(Date) + ')';
with DM.TourTable do
  begin
    Open;
    Filter := myFilter;
    Filtered := True;
  end;
end;

See the error?, I couldn't.

Thanks Again

 

Re:Nuts Over Filter Statement!!


I can see several problems from your filter.

First, what is the value of Field show?  True, or something else?  It must
be the value of the field, not what you see in the controls.  I cannot fnd
any database datatype that store value True.  If it is boolean, it may be
using 1 and 0, or using 'T' and 'F', or using 'Y' and 'N'.  Find it out and
compare your field to the value in your table.   If it is of type char or
char[n] etc, then the field's fieldtype will be ftstring, then you have to
quote your value like Show <> 'T'.

In the Date portion, first the logical operator is incorrect, I never see
this operator, I guess it is a typo.  But your date must be in quotes like:
'ShowDate >= ' + QuotedStr(DateToStr(Date));

Ping

Quote
Juan Rosique <j...@spiinc.com> wrote in message

news:8baod3$h355@bornews.borland.com...
Quote
> Hi:

> Newbie here.  I'm trynig to filter a dataset, but everytime I run the app,
> the BDE returns with an error.  Something like "Arithmetic Function Not
> Supported", huh?  Below is the code to set the filter.  Thanks in advance.

> procedure TfCheckIn.FormActivate(Sender: TObject);
> begin
> DatePicker.Date := Date;
> myFilter := '(Show <> True) and (ShowDate = > ' + DateToStr(Date) + ')';
> with DM.TourTable do
>   begin
>     Open;
>     Filter := myFilter;
>     Filtered := True;
>   end;
> end;

> See the error?, I couldn't.

> Thanks Again

Re:Nuts Over Filter Statement!!


On Wed, 22 Mar 2000 10:28:59 -0500, "Juan Rosique" <j...@spiinc.com>
wrote:

Quote
>myFilter := '(Show <> True) and (ShowDate = > ' + DateToStr(Date) + ')';

Change this to:
  myFilter := '(Show <> True) and (ShowDate >= ' +
    QuotedStr(FormatDateTime('mm/dd/yyyy', Date)) + ')';

HTH,

Jan

Re:Nuts Over Filter Statement!!


Try

myFilter := '(Show <> True) and (ShowDate = > ' + QuotedStr(DateToStr(Date))
+ ')';

The date must be in quotes.
--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:Nuts Over Filter Statement!!


Once Again, Saved by you Bill, you should tell me where to send you a box of
chocolates man!  You are excellent.

Keep it up man.

Thanks

Bill Todd (TeamB) <b...@dbginc.com> wrote in message
news:8bbtu6$q4u14@bornews.borland.com...

Quote
> Try

> myFilter := '(Show <> True) and (ShowDate = > ' +

QuotedStr(DateToStr(Date))
Quote
> + ')';

> The date must be in quotes.
> --
> Bill

> Bill Todd (TeamB)
> (TeamB cannot respond to questions received via email)

Re:Nuts Over Filter Statement!!


My sister sent me a box of chocolates for Christmas. My wife hid them.  Life
is hard<g>.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Other Threads