Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Numeric keys in View filter
Message
From
09/10/2002 21:03:34
 
 
To
09/10/2002 20:50:58
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00709641
Message ID:
00709650
Views:
13
>>>Hello fellow viewers,
>>>
>>>I would like to include a numeric field in a view filter.
>>>
>>>However, when I do, and then bind that view to a query-by-example form, the numeric field cannot be null. This works fine as long as the user uses the numeric value to do the lookup, but what if he doesn't?
>>>
>>>If I set the .value of the field to "", I get a data type mismatch.
>>>
>>>Has anyone done this successfully? If so, how?
>>
>>If not NULLable, the empty numeric value is 0.
>
>Ed,
>
>I am making memory variables named after the ones I used in the filter.
>(e.g. for Custid = ?vp_custid, I create a mem var named vp_custid).
>
>I just set the memvar to "" if it's character and the view ignores it. Are you saying I should set the memvar to NULL if the field (in this case Custid) is numeric?

Only if the field is NULLable; there are simply too many times where 0 (the default EMPTY() for a variable type of N or Y) is a viable potential value - NULL is not 0, and is not empty, but NULL is not a viable numeric value; the data type taken on and return by VARTYPE() for a NULL valued numeric field is 'X'; this allows a distinction between a valid 0 value and 'no value'. The use of ISNULL() allows you to distinguish between the two; if you insist on using EMPTY() as a test, you lose the viability of 0 as a value.
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
Reply
Map
View

Click here to load this message in the networking platform