>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