Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting an empty value
Message
 
To
13/05/2008 15:11:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01316738
Message ID:
01316768
Views:
15
Maybe
CLEAR
CLOSE DATABASES all

CREATE CURSOR crsTest (myBlob Blob)
aa = FILETOSTR(HOME(4)+[Bitmaps\Assorted\BALLOON.BMP])
INSERT INTO crsTest VALUES(aa)
myVar = DATE()
? EmptyVal(TYPE([myVar]))

myVar = 98
? EmptyVal(TYPE([myVar]))

myVar = [Vlado]
? EmptyVal(TYPE([myVar]))

myVar = crsTest.myBlob
? EmptyVal(TYPE([myVar]))
? [END]

RETURN

**********
FUNCTION EmptyVal(lcType)
**********
Return CAST([] AS &lcType) 
>Is there a simple way (without having to check all the datatypes) to get the equivalent empty value for a variable. For example
>FOO(12) ------------> 0
>FOO("abcd") --------> ""
>FOO(DATE()) --------> { }
>FOO(DATETIME()) ----> { :}
>etc.
>
>I can write FOO if I need to. Just wondering if there is already a feature in the language.
>
>Thanks......Rich
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Reply
Map
View

Click here to load this message in the networking platform