Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reset FILTER

Status
Not open for further replies.

josefidalgo

Programmer
Aug 15, 2015
6
PT
I Have the filter

select tmpcursor
SET FILTER TO data>=txtinidata

how reset the filter to return the original cursor
 
There is a dv_foxhelp.chm (vfp9) or foxhelp.chm (vfp6) in the folder you installed VFP in. You can click these helpfiles for most of the basic information you need. Or press F1 in the command window (or anywhere else) if your file locations are set properly. Tools->Options.

When you issue SET FILTER TO without using lExpression, you will turn off the filter for the current table.

 
My pennyworth

You can set filters using variables to so you can save and restore the filter state if you want to.

Code:
M.Filter1 = "Val(MyField) = 100"
m.Filter2 = "Val(MyField) = 200"
set filter to Evaluate(m.Filter1)  && set it
m.OldFilter = Set("Filter")  && save it
set filter to Evaluate(m.Filter2)  && change it
set filter to Evaluate(m.OldFilter) && restore it




Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Griff,

while it works, it introduces the dependence on the scope of the OldFilter variable.

After you set filter to Evaluate(m.OldFilter) compare the filter as it was (m.OldFilter itself) with SET("FILTER") as it is reflected now...

See?

If you had soemthing like SET FILTER TO ID=1
then store that in OldFilter via
[pre]OldFilter = SET("FILTER")[/pre]
then OldfFilter is "ID=1".

If you now "reset" via SET FILTER TO Evaluate(m.OldFilter) you only get the record with ID=1. That's fine. But your reset filter condition literally is "Evaluate(mOldFilter)" and if now or in following code m.OldFilter changes its value, eg when using OldFilter = SET("FILTER") elsewhere to remember the old filter condition of another workarea, your filter here surprisingly will change its behaviour!

Don't do that, here you need macro substitution to reset the filter: SET FILTER TO &m.OldFilter.

Bye, Olaf.
 
I know you are right Olaf, I was trying to make it clear that you could save and restore the filter state.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top