Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TYPE variable error
Message
 
To
24/01/2009 09:53:31
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01376717
Message ID:
01376893
Views:
8
>Getting "Function argument value, type, or count is invalid" error on this line if lcExistingValue is .F. when getting here. I still can't figure out what is the best way to check for the existence of a variable and whether it has a value.
>
>		IF TYPE(lcExistingValue) = 'C' AND !EMPTY(lcExistingValue)
>
Jay,

Just to add a little to what Dan said. The TYPE() function takes an expression as its argument and evaluates that expression for the data type while the VarType() function takes a variable as its argument. So TYPE("lcVariable") and VarType(lcVariable) will give the data type of the same thing. I prefer the VarType() function when I know the variable does exist and the TYPE() function when I am not sure iof it exists or not especially when delaing with objects and their properties because VarType(oObject.Property) will erro out if oObject doe snot exist while TYPE("oObject.Property") will simply return U as undefined.
Previous
Reply
Map
View

Click here to load this message in the networking platform