Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding Custom View Parameter?
Message
From
08/09/2008 11:17:55
 
 
To
08/09/2008 11:06:41
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01345719
Message ID:
01345767
Views:
23
>In the thread, Re: Macro substitution in sql views no longer possible Thread #975746 Message #976496
>the following quote appears:
>"I thought '&?' makes it clearer, when you see the SQL, that the variable is a parameter. I also like that in VFP9 you must define the variable before you can create a view, or else you get an error."
>When I run the Sql now using the &?vp_filter
>
>   AND &?vp_filter ;
>
>I get the following error: "Missing operand".
>
>Is this due to the fact that I have not defined the variable?
>I define it in the parm list of the view:
>
>parm_list=parm_list+"vp_Gender,'C';vp_ParFirst,'C';vp_ParLast,'C';vp_filter,'C'"
>
>But is there something else I am missing?
>On the Search button of the business object form, I am defining a private vp_filter.

Amanda,

Before requery() or before use view (without nodata) all parameters have to be visible

Changing the parm_list of the view does not help - it's only for documentation purposes, I think

In your case, each of the &?params must be defined
suppose :
   .. and &?vp_filter 

private vp_filter
if ( nothing in the filter )
  vp_filter = '.T.'
else
  vp_filter = [( state = '13')]
endif

=Requery(AliasOfTheView)
When you create the view - make sure a (any good) value for the parameter is defined
 vp_filter = [( state = '00')]

create sql  view .,...
as select .....
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform