Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro expansion of view parameter
Message
From
21/07/2003 08:15:19
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
20/07/2003 16:04:41
Alan Harris-Reid
Baseline Data Services
Devon, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00811862
Message ID:
00811959
Views:
12
Hi Alan,

My knowlegde on this:
&Filter will be expanded on the moment of view creation so it will be worthless to you.
You may use &?lcFilter.
Those construct will work with native views with vfp 6 / 7 not but with vfp 8.0 (I run into that). in vfp 8.0 a cursoradapter will do fit the &lcFilter into the SELECTCMD String. Be carefull with macroexpansion in strings. It may do unexpected work.
Try:
lcx = 'Test'
lcy = ' MyString &lcx or Myvar &'+'lcx'
?lcy
for example

But this for native views.

For your problem it seems that the &lcWhere is send to the remote source without expansion, what will cause the error. IOW I read the error message like: VFP will not expand the macro for remote views.

I have not done with remote views, so I can not do further assistance. The only thing I have heard of are store procedures on the remote side. But I have never done things like this.

HTH
Agnes
>I need to contstruct a remote view using a variable WHERE clause. The syntax I have used is CREATE SQL VIEW MyView CONNECTION MyConnection AS SELECT * FROM MyTable WHERE &lcFilter. lcFilter could be something like 'MyField1=Value1 AND MyField2=Value2'.
>
>When I USE MyView, I get the error "Connectivity error. Incorrect syntax near '&'." I also get this message if I change the view parameter to &?lcFilter.
>
>If I change the parameter to ?&lcFilter, the error message is "SQL parameter is missing".
>
>I have read on this forum that it is possible to use macro expansion in a view definition, so has anyone any idea what I might be doing wrong? How else can I set the WHERE filter at runtime for remote views? I am using VFP6/7 as a front-end to MSDE for development (SQL7 at client site).
>
>Any help would be appreciated.
>
>Alan Harris-Reid
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform