Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IN clause in Parameterized views
Message
De
01/04/1999 18:11:46
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
À
01/04/1999 11:21:33
Bruce Gilmour
Cal-Mour Consultants
Calgary, Alberta, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00204282
Message ID:
00204490
Vues:
15
Hey Bruce;

There is a workaround way to solve this.
Here is a dumb way and doesn't let you use the named view (assume test)

x = dbgetprop('test','view','sql')
y = strtran(x, "?yourparameter", yourlistvariable)
&y

The above gets the result set back with a cursor named query.

The alternative is to create a table called list;

Create table list (;
userid INTEGER, ;
parameter C(254) )

Delete all records in list for the matching userid (this user) and then add any items that match the selected parameter.
Your IN table then joins to this list table with two parameters, the userid and the parameter field matching whatever other field you need. This allows multiple users to access the table independent of each other.

If you want to get real fancy, the sql property of the view in the database container is read-only but I think StoneField Database toolkit has methods that will update the sql value of an existing view. this would allow you to replace the sql with the value of y and then open the view. this would mean each user has a local copy of the DBC etc.

>Now I freely admit I may have missed something on this in the past but here goes anyway.
>
>I want to create a view that contains only certain records (eg- from an order file containing orders 1 through 15 I want to print 3, 6, 7, 9, 12 where the order number is a character field). I figured the easiest way was a parameterized view that contained a clause such as "WHERE ordernumber IN ?mylist". It doesn't work. Depending on the makeup of the list stored in the mylist variable, it usually only selects the first item in the list. I have tried storing the following strings to mylist:-
>
> " 3"," 6"," 7"
> (" 3"," 6"," 7")
> 3"," 6"," 7
> as well as any other variation I could think of. That last one was in case quotes were automatically being put around my string when it was passed. I am using VFP 5.0. Does this work in 6.0 or is it not supposed to work in the first place? I would prefer to use a parameterized view instead of creating a custom view in my code but I am open to suggestions.
>
>Also how do other people handle or reccomend handling the need to print a random list of things (such as orders) where the data comes from multiple files?
>
>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform