Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic View
Message
From
10/08/2001 03:11:31
Walter Meester
HoogkarspelNetherlands
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00540559
Message ID:
00542147
Views:
28
Hi Chris and all,

I'm stumped that no-one came up with the following solution though I thought it was commonly known that the following works perfectly.
SELECT *;
   FROM gen_data!customers;
   WHERE &?cWhere ;
   ORDER BY Customers.cu_company
You can define you selection criteria in cWhere (for example "Customers.cu_primary BETWEEN ?vp_LowPk AND ?vp_HighPk AND DELETED() <> .T.". Of course the cWhere variable must be available when this view is loaded (Or NodataOnload must be set to .t.) and requeried.

Of course you could, like Larry says, put the whole command into a string, but then you don't have an updatable view anymore.

Walter,


>Hi - just checking I am barking up the right tree!
>
>I want a view that pulls out records from a base table. The user selects all customers so I have a view with this SQL...
>
>SELECT *;
> FROM gen_data!customers;
> WHERE Customers.cu_primary BETWEEN ?vp_LowPk AND ?vp_HighPk;
> AND DELETED() <> .T.;
> ORDER BY Customers.cu_company
>
>That's fine. But can't I use the following SQL and supply a value for vp_Field and vp_Criteria so that it widens the possibilities?
>
>SELECT *;
> FROM gen_data!customers;
> WHERE Customers.cu_primary BETWEEN ?vp_LowPk AND ?vp_HighPk;
> AND ?vp_Field = ?vp_Criteria;
> AND DELETED() <> .T.;
> ORDER BY Customers.cu_company
>
>I am passing vp_Field = "customers.cu_code" and vp_Criteria as "EMD" (a company code)
>
>This doesn't seem to work and the problem seems to lie with assigning a field.
>
>Am I missing something? Any ideas?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform