Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a conditional 'where' clause
Message
From
04/06/1999 08:38:29
 
 
To
03/06/1999 20:38:18
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00226172
Message ID:
00226440
Views:
22
>You can do this by creating your remote view via code... you can't creat or open this view in the view designer...
>
>create sql view MyView remote share as 'select * from p1 where &lcwhere'
>
>Now that you have the remote view created, you just have to make sure that you populate a private variable lcWhere with your where. So, for the situation above you might have code like...
>
>
>if gcFunction = '001'
>   lcWhere = '.t.'
>else
>   lcWhere = 'p1_funckey = @gcfunction'
>endif
>
>use MyView
>
>
>Let me know if this works... I am not sure if it is exactally right... this technique was in a FoxAdvisor last year.
>
>BOb

Nope, doesn't work. I tried it with the select statement both with and without quotes (your example shows quotes). When I run the code to create the view, it bombs unless there's a value for lcwhere. If I give lcwhere a value, then the view is forever defined with that value.

I've finally decided that I need two views, one with a parameter, and one without, then I'll just USE whichever I need and ALIAS it to a single name.

Thanks for everybody's suggestions. You'd think this would be easier. I guess what I really am looking for is a view 'class' that I could then sub-class. Guess that doesn't exist -- yet. Have to think about that one for a while, maybe I can come up with something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform