Hi Sergey,
try the following
nx=0
nx=NULL
?TYPE('NX')
?STR(nx)
nx='c'
nx=NULL
?TYPE('NX')
?STR(nx)
This is because STR() correctly checks for numeric types.
It should not produce an error for a NULL if the type is Numeric.
STR() can be used to numeric fields and fields may store NULL.
A SQL SELECT using STR correctly gives NULL for NULL and a string for !NULL.
Agnes
>Hi Fabio,
>
>I disagee with you. The parameter of the function is numeric expression so function correctly generates an error when you try to pass it variable of character data type. It should also generate an error when parameter is Null because it's not a numeric value. You can use NVL() function to handle nulls.
>
>>Hi
>>
>>x=NULL
>>? STR(null)
>>
>>OK : STR return NULL
>>BUG : NULL type is not "C"; LTRIM(),RTRIM()... return NULL "C" type correclty
>>
>>? STR(x)
>>
>>BUG: STR return error type
>>
>>For VFP Team: solution
>>
>>your internal code is:
>>if (parameterType#'C')
>> Error;
>>if (parameterValue=NULL)
>> return parameterValue;
>>
>>correct is ( LTRIM .. RTRIM uses this schema ):
>>if (parameterValue=NULL)
>> return charsNullvalue;
>>if (parameterType#'C')
>> Error;
>>
>>
>>Fabio
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]