Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What does this text do?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01348085
Message ID:
01348197
Views:
17
>In a SQL select statement. (original code VFP 5) I came across the code below as part of the WHERE clause
>
>(Empty(?ThisForm.Customer) or  ?ThisForm.Customer= Ordhead.customerid)
>
>
>As stated previously, empty is not rushmore optimizable, therefore how do I change this to return the same info. I am rewriting the queries in VFP 9 and wish to get the same results.
>
>Mike

Depedning on the type of thisform.Customer (I assume it's Integer) you can also do

?thisform.Customer = 0 OR OrderHead.CustomerID = ?thisform.Customer (also you don't need ? here, the result would be the same without it).

The idea of this query is to allow "All" records in case the parameter was not supplied. So, if the parameter is Integer, you check for 0. If it's character, you check

thisform.Customer ==""

if it's a date, you check with thisform.Date = {}

For empty datetime you may check with thisform.DateTime = {::} (if I recall correctly).

I think it covers most of types.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform