Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using $ in a parameterized view
Message
From
03/08/1999 11:12:02
 
 
To
03/08/1999 10:49:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00249230
Message ID:
00249241
Views:
19
>I would like to move an app from 2.6 to VFP5. Basically the app searches on field information and displays the results. One field is a 60 character description field. A person may want to search for "MAIN STREET" and then visually scan the results for the exact record desired. The 2.6 version uses a sql select and a cursor to display the results in a browse. I would like to use a parameterized view in VFP to do the same.
>
>Is it possible to use something like:
>
>SELECT * ;
> FROM SHAREDWO ;
> WHERE cDescription $ SHAREDWO.DESCRIPT
>
>where cDescription is a passed parameter? I'm not having much success.

Rather than using the internal $ operator, you might try converting to use the ANSI SQL LIKE clause for your compare, prefixing the comparison value with appropriate wildcards for ANSI SQL. If you want to emulate $, the equivalent code is shown below. Note that with a parameterized view, the use of the ? prefix to specify the argument is a view parameter is required:
SELECT * ;
  FROM SharedWO ;
  WHERE Descript LIKE ?cDescription  && this is the Select for the view
*  avoid putting an alias in place if you don't need it

*  To use it, do the following:

cDescription = '%'+cDescription + '%' && % matches 0 or more characters
USE <i>my parameterized view name</>  && opens the parameterized view 
*  This will use the current value of cDescription;  if it is not defined, you
*  will be prompted for it.  NODATA will open the parameterized view
*  but will not attempt to read any data, so the cDescription needn't be
*  defined at the time that the USE statement is issued.  If you use the DE
*  you'll want to set the NODATAONLOAD property for the view.
*  On a requery, you should ensure that either the original cDescription is in
*  scope, or simply redfine it before the requery is issued
cDescription = '%'+cDescription + '%' && % matches 0 or more characters
=REQUERY(<i>char expn alias of parameterized view being requeried</i>)
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform