Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a view with a variable condition?
Message
From
09/02/2001 13:33:39
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00474379
Message ID:
00474531
Views:
37
Hi pablo,

>>Yes, this is possible. You're on the right track. Just try it and you'll see this will work. On thing to keep in mind though is to load those views with the NoDataOnLoad property set to false, or else it will error that the 'mycondition' variable does not exist.

>I can't put this into work Walter, can you write a sample?

Don't bother the whole statement, its just a copy of the first viewdefinition I could find. Just note the &?cWhere.
CREATE SQL VIEW "VW_ZIEKMELDING" ; 
   AS SELECT Ziekmelding.*, PADR(ALLTRIM(Werknemer.wrk_naam)+", "+ALLTRIM(Werknemer.wrk_vlet)+" "+ Werknemer.wrk_tussen,50) AS naam, ;
   		Unit.unt_naam, Afdeling.afd_naam, Afdeling.afd_pk, Unit.unt_pk, afw_omschr, ;
   		IIF(zie_hersteldatum={},DATE()+1,zie_hersteldatum)-Zie_eerstedatum as Dagen ;
   		FROM  verlof!ziekmelding ;
   			INNER JOIN verlof!werknemer ON  Ziekmelding.zie_wrkfk = Werknemer.wrk_pk ;
   			INNER JOIN verlof!unit 	 ON  Ziekmelding.zie_untfk = Unit.unt_pk ;
   			INNER JOIN verlof!afdeling  ON Ziekmelding.zie_afdfk = Afdeling.afd_pk ;
   			LEFT JOIN  verlof!afwkodes  ON Ziekmelding.zie_afwfk = Afwkodes.afw_pk ;
   		WHERE &?cWhere ;
   		ORDER BY zie_meldtimestamp DESC
Now everytime you load it (without the NODATA clause or the NodataOnLoad property set) you've got to make sure the cWhere variable exists.

HTH,

Walter,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform