Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable numeric or character
Message
From
10/01/2014 17:58:09
 
 
To
10/01/2014 09:13:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01591614
Message ID:
01591696
Views:
70
Likes (1)
>>Beware, do not use TYPE(). It was added for speed but makes little difference and is
>>known for returning the wrong result at times. I have seen this myself.
>
>I know, it may return C or something else when the value is null
>
>As in
>
>x='qq'
>x=null
>?type('x')  && C
>
This is not a wrong result. X was previously defined to be character. When a NULL value is populated into X it is a NULL Character. The same holds true if you use x=10 and x=null. It now reports a NULL Numeric. It is reporting exactly the type of variable it is ... it's just that now instead of being populated with data, it is populated with empty data (a null).

This is often useful for testing for unpopulated data. Try this:
x = 10
x = null
@ 5,5 get x
READ
It initially shows ".NULL." but when you try to type input, it only allows numbers. If the user types anything (even the letter "k") the value changes to 0. If the user doesn't type anything in that field then it remains NULL.

This is a perfectly valid and legal concept in both VFP and computer science in general, and one which relates to the underlying programming languages of C/C++ down through assembly and machine code and the concept of a "null pointer".
Previous
Reply
Map
View

Click here to load this message in the networking platform