The information in this article applies to:
- Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a
SUMMARY
The following article demonstrates how to filter records in the
DataEnvironment of a form and how to remove the filter.
MORE INFORMATION
- Create a new form and add the Customer.dbf table from the directory
<drive>:\VFP\samples\mainsamp\data to the DataEnvironment (from the
view menu, select Data Environment.
- From the DataEnvironment menu, select Add and then select the customer
table.
- Drag the customer_id field, the company_name field, and the country
field to the form and add three command buttons to the form.
- In the click event of the first command button, place the following
code:
ThisForm.DataEnvironment.cursor1.filter = "country = 'Germany'"
ThisForm.Refresh
- In the click event of the second button place the following code:
ThisForm.DataEnvironment.cursor1.filter = ".T."
ThisForm.Refresh && Note: Record position is lost with this code.
- or -
STORE ThisForm.DataEnvironment.cursor1.alias to xVar
SELECT &xVar
SET FILTER to
ThisForm.Refresh && Note: record position is not lost.
- In the click event of the third button place the following code:
SKIP
IF EOF()
GO BOTTOM
ENDIF
Thisform.Refresh
- Save the form and run it. Click the button Command1 to apply the
filter, and then click the button Command2 to remove the filter.
REFERENCES
See the Visual Foxpro Help for reference to the Filter property and the
SET FILTER TO command.
|