Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trouble with views
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00441223
Message ID:
00441266
Views:
9
>>One way is to have a completely dynamic where clause, e.g.,
>>CREATE SQL VIEW lvMyView AS ;
>>  SELECT * FROM parcel ;
>>  WHERE &?lcPermitSearch
>>
>>Notes:
>>The "&" goes in front of the "?"
>>
>>This cannot be done in the view designer.
>>What you can do with the View Designer, however, is add the fields as you would want them, set the updatability of each, etc., then run GenDBC[X] -- actually GetView() from GenDBC[X] -- to get the definition of the view.
>>Then you can add the WHERE &?lcPermitSearch in the code and recreate the view.
>>
>>Then all you would have to is USE or REQUERY() the view instead of the SELECT.
>>
>
>Hi Trey,
>
>I'm somewhat 'view challenged' , so please forgive my ignorance in this area. With this approach is the CREATE SQL VIEW myview AS... still going to be in the DBC or am I just using the DBC to do some of the work for me (write some code for, send updates etc.)and then capture it with GENBDC and place it in a form method somewhere. Also, I couldn't find GetView(). As you can tell, I'm not quite there yet...but having fun!
>
>Thanks for your help.
>
>John

The view is created in the current DBC, and it will remain there until it is dropped. There is no need to create it again in the form. The database

To find GetView, modify GenDBC.prg then pull up the Procedure/Function List (right click menu), then go to GetView.
You may need to modify this slightly to be able to extract the information you need.

This is basically the code I use to call GetView
( I left out some validation for clarity )
** GetViewCode.prg
LParameters tcView
*****
* validation goes here to
* 1) ensure there is current database
* 2) ensure parameter is character
* 3) ensure parameter is view in the current database
*****
Do Case 
Case File("Gendbcx.prg")
  lnHandle = FCreate(ForceExt(tcView,"prg"))
  If lnHandle > 0
    Set Procedure To GenDBCX
    GetView(tcView, lnHandle, "")
    FClose(lnHandle)
  EndIf

Case File("Gendbc.prg")
  Set Procedure To GenDBC
  GetView(tcView, ForceExt(tcView,"prg"))

Otherwise
  Return

EndCase

Modify Command (tcView) Nowait
Under this scenario, either will create a PRG with the same name as the view.
GenDBCX will start with PROCEDURE lv_MyViewName....
GenDBC will start with FUNCTION MakeView_lv_MyViewName...
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform