Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memvars and views
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00141161
Message ID:
00141193
Views:
27
>I have created a view in VFP 5.0. I need to filter using a memvar. I would like use a memvar as part of the filter for the view. When I try to do this in the view designer I get an error. How do I create this filter using a memvar.

What you need is a "Parameterized View". In the view designer, when it asks for the value where you want your MemVar, put ?MyMemvar. A question mark then the MemVar name. A WHERE clause would be
State = ?MyState
In your code, BEFORE you USE the view, you will need to assign a value to "MyState" such as MyState = "CA" or MyState = "MD". If you forget, VFP will prompt you (or your enduser) but the screen isn't pretty :-)

You can use several parameters like this in any view.

Another point: If you put your view into the DataEnvironment, you should check the NoDataOnLOad property (in the Data tab) to TRUE. Then the view will load without data and without checking for a parameter. When you need to use it, assign a value to your parameter(s) and REQUERY the view.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform