Groups > dBase > dBase programming > Re: Trouble in River City - Filters




Trouble in River City - Filters

Trouble in River City - Filters
Mon, 31 Mar 2008 12:53:56 -050
Hey Everybody!

I'v run into a little snaf-foo trying to get my Filter expression to accept a
variable passed into the procedure as a parameter

All works well as long as I use a literal date to filter the rowset, but get
errors when I pass in a date to filter the rowset?

Error - usually "Capability not supported"
  Form1.QUERYDEXAM1.RowSet.Filter := [EXDATE = Ex_Date]
Works
 Form1.QUERYDEXAM1.RowSet.Filter := [EXDATE = {11/01/2007}]

I just did get this to work,as I was Typing This, by Converting Ex_date to
String

Str_Date := Dtoc(Ex_Date)

Str_Date := "{" + Str_Date + "}"
 Form1.QUERYDEXAM1.RowSet.Filter := [EXDATE = Str_Date]

Filter must like to see thoes curly braces, not just Date Type Data?

Sent this any way to see if there are any comments?

Don

Post Reply
Re: Trouble in River City - Filters
Mon, 31 Mar 2008 12:58:14 -050
Don Wrote:

> Hey Everybody!
> 
> > 
> > 
> Str_Date := Dtoc(Ex_Date)
> 
> Str_Date := "{" + Str_Date + "}"
>  Form1.QUERYDEXAM1.RowSet.Filter := [EXDATE = &Str_Date]
> 

Forgot to type in my ampersand in above posting, the filter works with above
code

> > 
> Don
> 
> 
Post Reply
Re: Trouble in River City - Filters
Tue, 1 Apr 2008 09:13:22 -0500
Hi Don,

filters are simple string expressions, so there is really no need to use the 
& macro operator.

Both date and character values must be enclosed into single quotes:

Filter = [Name = 'Don' and DOB='01/01/1960']

Hope this helps,

Jan

Post Reply
Re: Trouble in River City - Filters
Tue, 01 Apr 2008 21:18:20 -050
Jan Hoelterling Wrote:

> Hi Don,
> 
> filters are simple string expressions, so there is really no need to use
the 
> & macro operator.
> 
> Both date and character values must be enclosed into single quotes:
> 
> Filter = [Name = 'Don' and DOB='01/01/1960']
> 
> Hope this helps,
> 
> Jan
> 
> 
Thanks Jan

I will play with that this wk end when I do my Programming.

Post Reply
Re: Trouble in River City - Filters
Tue, 1 Apr 2008 22:32:45 -0400
In article <43z1aVAlIHA.1688@news-server>, jan@hoelterling.com says...
> Hi Don,
> 
> filters are simple string expressions, so there is really no need to use
the 
> & macro operator.
> 
> Both date and character values must be enclosed into single quotes:
> 
> Filter = [Name = 'Don' and DOB='01/01/1960']
> 
> Hope this helps,
> 
> Jan
 

Jan & Don,

To avoid hard-coded strings (and avoid macros), you can change this:

Filter = [Name = 'Don' and DOB='01/01/1960']

to this:

Filter = [Name = '] + cName + [' and DOB='] + cMM_DD_YYYY + [']

These are both strings which contain 'Don' and '01/01/1960'.

-- 
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact