Discussion:
rowset filter
(too old to reply)
Philip Whitley
2008-11-25 05:52:14 UTC
Permalink
Hi All

I use to set a filter to look for a part string in a field as follows:

set filter to at(msrch,field)>0

How do I achieve this in a rowset filter?

Thanks in advance.
Ken Mayer [dBVIPS]
2008-11-25 13:27:55 UTC
Permalink
Post by Philip Whitley
Hi All
set filter to at(msrch,field)>0
How do I achieve this in a rowset filter?
You don't. The filter property of the rowset does not understand
standard dBASE expressions. Instead, you might need to use the canGetRow
method of the rowset:

function rowset_canGetRow
local bReturn
bReturn = false
if at( msrch, this.fields["fieldname"].value ) > 0
bReturn := true
endif
return bReturn

The one problem with this would be getting the value of msrch to the
method. Perhaps a reference to a form object ... or ...?

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Philip Whitley
2008-11-25 22:22:42 UTC
Permalink
Thanks Ken
Post by Ken Mayer [dBVIPS]
Post by Philip Whitley
Hi All
set filter to at(msrch,field)>0
How do I achieve this in a rowset filter?
You don't. The filter property of the rowset does not understand
standard dBASE expressions. Instead, you might need to use the canGetRow
function rowset_canGetRow
local bReturn
bReturn = false
if at( msrch, this.fields["fieldname"].value ) > 0
bReturn := true
endif
return bReturn
The one problem with this would be getting the value of msrch to the
method. Perhaps a reference to a form object ... or ...?
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Philip Whitley
2008-11-26 00:01:10 UTC
Permalink
I passed a field value to mysearch in the onclick event of a button then placed the following code in the rowset.canGetRow event.

All worked well

function rowset_canGetRow
if mysearch<=" "
return true
else
if at( mysearch, upper(this.fields["t_description"].value )) > 0
return true
endif
if at( mysearch, upper(this.fields["t_otherparty"].value )) > 0
return true
endif
if at( mysearch, upper(this.fields["t_reference"].value )) > 0
return true
endif
if val( mysearch)=this.fields["t_amount"].value
return true
endif
endif
return false

Thanks again Ken
Post by Philip Whitley
Thanks Ken
Post by Ken Mayer [dBVIPS]
Post by Philip Whitley
Hi All
set filter to at(msrch,field)>0
How do I achieve this in a rowset filter?
You don't. The filter property of the rowset does not understand
standard dBASE expressions. Instead, you might need to use the canGetRow
function rowset_canGetRow
local bReturn
bReturn = false
if at( msrch, this.fields["fieldname"].value ) > 0
bReturn := true
endif
return bReturn
The one problem with this would be getting the value of msrch to the
method. Perhaps a reference to a form object ... or ...?
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Ken Mayer [dBVIPS]
2008-11-26 05:47:43 UTC
Permalink
Post by Philip Whitley
I passed a field value to mysearch in the onclick event of a button then placed the following code in the rowset.canGetRow event.
All worked well
function rowset_canGetRow
if mysearch<=" "
return true
else
if at( mysearch, upper(this.fields["t_description"].value )) > 0
return true
endif
if at( mysearch, upper(this.fields["t_otherparty"].value )) > 0
return true
endif
if at( mysearch, upper(this.fields["t_reference"].value )) > 0
return true
endif
if val( mysearch)=this.fields["t_amount"].value
return true
endif
endif
return false
Thanks again Ken
My pleasure -- it's what we do here. <g>

Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
http://www.goldenstag.net/dbase
Loading...