Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Frustrating view behaviour in 9.0
Message
From
19/01/2005 08:54:10
Emmanuel Huybrechts
Technimeca International Corp.
Montréal, Quebec, Canada
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Title:
Frustrating view behaviour in 9.0
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00978506
Message ID:
00978506
Views:
59
While it's not mentionned in the documentation, macro substition in the WHERE clause of a CREATE SQL VIEW statement is
no longer supported as in prior versions (because of improved statement
validation according to Jim Saunders).

We have now to put a ? after the &
That's fine, but we also have to make sure the variable used for macro-substitution is in scope! Like this:
CREATE DATABASE testMacro
CREATE TABLE testMacro (f1 I)
APPEND BLANK
APPEND BLANK

pFilter=".T."

CREATE SQL VIEW exampl AS SELECT temp.* FROM testMacro temp WHERE
&?pFilter

DBSetProp("exampl","View","ParameterList","pFilter,'C'") 
It means that even if you do :
USE testMacro!exampl NODATA
You'll still need to have the variable pFilter in scope ! That behaviour was not happening in previous VFP versions. The problem is: I can't use VFP 9 because this new behaviour breaks existing application created in VFP 8. I wished we had a "SET ..." command allowing to bypass this new behaviour. This behaviour should be added in "Critical changes" section of the documentation or at least in the readme file.

To the VFP team: please, fix this problem, I want to use 9.0 !

One more thing, the ? doesn't work very well either. If you open the view (without using NODATA), it will ask for the parameter but any value you supply will give a syntax error.
Reply
Map
View

Click here to load this message in the networking platform