Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Empty() vs 2 quotes
Message
 
To
21/10/2011 12:43:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01526798
Message ID:
01527064
Views:
62
>>>>>You can use
>>>>>
>>>>>update States set State = 'SP' where Len(State) = 0 && Empty state
>>>>
>>>>That will not work, as all fields will have the length of the field, you need len(alltrim(State)) = 0, but I would rather use empty(State)
>>>
>>>In this case EMPTY(State) should work (assuming State is not a memo field).
>>
>>Empty() works on any type of field or expression, that's the beauty of it. Even memos.
>
>I know it's properly documented, but EMPTY() does not work on memos -- at least not the way I expected.
>CREATE CURSOR xx (m1 m)
>APPEND BLANK
>? EMPTY(m1) ---> .T.
>REPLACE m1 WITH SPACE(5)
>? EMPTY(m1) ---> .F.
Yes it is confusing but still documented in VFP Help very clearly:
Memo   Empty (no contents)
With space(5), memo field gets a contents, so it is not empty().
Probably ?len(mem_field)=0 would return what you need.

Good Luck
Previous
Reply
Map
View

Click here to load this message in the networking platform