dBASE Programming - rowset filter with calculated fields

This is Interesting: Free IT Magazines  
Home > Archive > dBASE Programming > January 2007 > rowset filter with calculated fields





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author rowset filter with calculated fields
Graham Monk

2007-01-23, 1:23 am

I am struggling to get a filter with a calculated field to work. I am
getting Variable Undefined: MoB, where MoB is Month-of-Birth derived by a
BeforeGetValue function that returns cmonth(DoB). If I pre-define the field
in the table keeping the BeforeGetValue function then all seems OK. Is what
I am doing meant ot work?

I am using Win2000 and dBase 2.6.1.1

Cheers,
Graham


Geoff Wass [dBVIPS]

2007-01-23, 1:23 am

In article <xRUYWwoPHHA.1516@news-server>, graham@astutesoftware.com
says...
> I am struggling to get a filter with a calculated field to work. I am
> getting Variable Undefined: MoB, where MoB is Month-of-Birth derived by a
> BeforeGetValue function that returns cmonth(DoB). If I pre-define the field
> in the table keeping the BeforeGetValue function then all seems OK. Is what
> I am doing meant ot work?
>
> I am using Win2000 and dBase 2.6.1.1
>
> Cheers,
> Graham



Graham,

You cannot use a calculated field inside of a ROWSET.filter. You can do
one of the following instead:

(1) Make a SQL calculated field in the ROWSET.sql and filter on it.

To do this, your SQL calculated field would have to be the number of the
month (01 to 12) and then your filter would have to be

ROWSET.filter := "MoB = " + month( "<monthName>" )

(2) Use the ROWSET.canGetRow() method to select the rows.

To do this, you would keep your calculated field the way it is and then
choose only those rows which equal "<monthName>"

"<monthName>" would be the "January" through "December" value chosen by
the user.

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

..|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
..|.|.| ---------------------------------------------------------- |.|.|.
..|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Graham Monk

2007-01-23, 7:52 pm

Hi Geoff,

Many thanks for taking the time to reply. I will give it a try.

Cheers,
Graham

"Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in message
news:MPG.201f690cc773aed1989721@news.dbase.com...
> In article <xRUYWwoPHHA.1516@news-server>, graham@astutesoftware.com
> says...
a[vbcol=seagreen]
field[vbcol=seagreen]
what[vbcol=seagreen]
>
>
> Graham,
>
> You cannot use a calculated field inside of a ROWSET.filter. You can do
> one of the following instead:
>
> (1) Make a SQL calculated field in the ROWSET.sql and filter on it.
>
> To do this, your SQL calculated field would have to be the number of the
> month (01 to 12) and then your filter would have to be
>
> ROWSET.filter := "MoB = " + month( "<monthName>" )
>
> (2) Use the ROWSET.canGetRow() method to select the rows.
>
> To do this, you would keep your calculated field the way it is and then
> choose only those rows which equal "<monthName>"
>
> "<monthName>" would be the "January" through "December" value chosen by
> the user.
>
> --
> Geoff Wass [dBVIPS]
> Montréal, Québec, Canada
>
> .|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
> .|.|.| ---------------------------------------------------------- |.|.|.
> .|.|.| IT Consultant http://Geoff_Wass.com |.|.|.



Geoff Wass [dBVIPS]

2007-01-24, 1:38 am

In article <LJyxlmzPHHA.1528@news-server>, graham@astutesoftware.com
says...[vbcol=seagreen]
> Hi Geoff,
>
> Many thanks for taking the time to reply. I will give it a try.
>
> Cheers,
> Graham
>
> "Geoff Wass [dBVIPS]" <gswassREMOVE_ME@attglobal.net> wrote in message
> news:MPG.201f690cc773aed1989721@news.dbase.com...
> a
> field
> what


Graham,

No problem! Have fun working on it! :-)

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

..|.|.| dBASE info at http://geocities.com/geoff_wass |.|.|.
..|.|.| ---------------------------------------------------------- |.|.|.
..|.|.| IT Consultant http://Geoff_Wass.com |.|.|.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com