Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Logical represenatation problem
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00326212
Message ID:
00326306
Views:
35
Hi Dore,

I tested your example, it should be:
CREATE CURSOR testing (somefield l null)
APPEND BLANK
BROW
DISPLAY
?ISBLANK(somefield) && .T.
REPLACE somefield WITH .F.
DISPLAY
BROW
?ISBLANK(somefield) && .F.
BLANK FIELD somefield
DISPLAY
?ISBLANK (somefield) && .T.
BROW
Note the difference between real field value and display representation...

>>>>This is not so. Every logical field actually has three states, .T., .F. or BLANK. Blank can be test with ISBLANK() and can be set with the BLANK command (and is the default status for a newly appended record). If the logical field is NULL enabled then it can have four states, the three above as well as .NULL. which can be set with REPLACE ... WITH .NULL. and can be tested with ISNULL(). They are all mutually exclusive states.
>>>
>>>Well ok, I didnt consider .NULL. since I rarely use them. But you cant say blank and .f. are mutually exclusive states since blank logicals evaluate to false.
>>
>>Thanks for the reply.
>>
>>CREATE CURSOR testing (somefield l null)
>>APPEND BLANK
>>?ISBLANK somefield && .T.
>>REPLACE somefield WITH .F.
>>?ISBLANK somefield && .F.
>>BLANK somefield
>>?ISBLANK somefield && .T.
>>
>>Therefore BLANK and .F. are not the same. The point I was making was that you can use a logical field to store three states (four with NULL enabled). I was in error to say that the four states are mutually exclusive since both BLANK logical and .F. evaluate to NOT TRUE (which is not the case with .NULL. which neither evaluates to TRUE or NOT TRUE). You can, however, put a four state value into a logical field if you are willing to test for BLANK and NULL.
>
>Sorry. I meant "ISBLANK(somefield)" in my examples above not "ISBLANK somefield".
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform