Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substitution in views
Message
De
28/03/2002 10:02:59
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00638376
Message ID:
00638444
Vues:
32
>Hello,
>
>I try to create a view that uses macro substitution because I need to evaluate different fields for a search screen.
>The view should look like this:
>
lcSearchString = " 1=1 "
>CREATE SQL VIEW VBooks AS ;
>	SELECT	B.caKey, ;
>		B.caISDN, ;
>		B.caTitle, ;
>		AU.auName, ;
>		PU.puName, ;
>		CA.caName ;
>	FROM Books B ;
>		LEFT OUTER JOIN Authors AU ;
>		ON B.caauKey = AU.auKey ;
>		LEFT OUTER JOIN Publish PU ;
>		ON B.capukey = PU.pukey ;
>		LEFT OUTER JOIN Categor CA ;
>		ON B.cacakey = CA.caKey ;
>	WHERE &lcSearchString ;
>	ORDER BY B.caTitle, B.caISDN
>USE VBooks
>The problem is, that the variable lcSearchString is evaluated only at the moment of the view definition. I cannot change this value and do the following:
>
lcSearchString = " B.caKey = 5 AND B.caTitle = 'Test' "
>REQUERY("VBooks")
>How can I do that?

If you know the fields will be the same, and the values different, a parameterized view (B.caKey= ?findmethiskey) looks like the easiest choice. If you are changing the fields as well as values, you'll probably have to forego the view for just SQL.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform