Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
NULL
Message
From
25/08/1999 13:55:28
 
 
To
25/08/1999 12:42:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: NULL
Miscellaneous
Thread ID:
00257266
Message ID:
00257547
Views:
15
>>>* control's valid
>>>IF EMPTY( THIS.Value )
>>> THIS.Value = .NULL.
>>>ENDIF
>>>
>>>This works for character and memo datatypes but I can't get it to work for numerics. When I type in a 0 (zero) and tab out it becomes NULL.
>>
>>The problem is that 0 is the defined EMPTY() value for a numeric field, and in this case, EMPTY() and ISNULL() do not mean the same things. You'll have the same problem with logicals, where .F. is empty but not null, and with dates, where {} is empty but not null. You might try changing the first line of Jim's code fragment to:
>>
>>IF VARTYPE(this.Value) = 'C' AND EMPTY(this.Value)
>>
>>since both memo fields and strings will return "C"
>
>OTOH, there's the IsBlank() function, which may be used to differ in some cases. Here's a quote from help:
>
>"ISBLANK( ) differs from EMPTY( ) and ISNULL( ). For example, EMPTY( ) returns true (.T.) if a character expression contains any combination of null values, spaces, tabs, carriage returns, or line feeds; ISBLANK( ) returns true (.T.) if a character expression contains only the empty string or spaces."

ISBLANK() does differentiate between SPACE(0) and the string full of whitespace; I was addressing the problem cited, where replacing an EMPTY() value with .NULL. was a problem, like with the numeric, logical and date datatypes, where EMPTY() and NULL aren't interchangable.
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