Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>>Hello everyone,
>>I would like to know how to pass a parameter to a view's "where" clause for conditions. For example, in different areas I may have different "where" clause conditions. In one instance, I may have "cField1 = 'x'" and in another instance "cField2 = 'y' .AND. !empty(cField1)". Is this possible? I had attempted the following but it did not work: "create sql view test as select * from myTable where ?x"
>>then before issuing the "use test" I assigned x="cField1 = 'x'". I would appreciate any suggestions.
>
>Others have responded to this question and I agree with all of them.
>
>You could use an open clause
>
>cExpr = "cField1 = 'x'"
>
>CREATE SQL VIEW "My_view" ;
> AS SELECT field_list from my_table ;
> where &cExpr
>
>This may blow up in your face though. Not having defined cExpr and trying to use the view in a form will error, all the time.
>
>__Stephen
What if you select NoDataOnLoad? then put a value in cExpr then do a REQUERY()?
Would that not work??
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement