Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comparing to NULL
Message
 
 
To
24/07/2007 06:55:12
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01243011
Message ID:
01243112
Views:
21
First, thank you for your input. But at first glance there might be a problem (or I have not had enough coffee today yet <g>). The function Str2Exp requires parameter tcType, yet your code has function Str2Exp with only one parameter (''). I will try to read more carefully again to find my mistake before you pointing it to me <g>.

>
>
>lcType = TYPE( FIELD( i ) )
>!( NVL( EVALUATE(FIELD(i)), Str2Exp( '' ) ) == NVL( OLDVAL(FIELD(i), "V_MYTABLE"), Str2Exp( '' ) ) )
>
>
>Here is Str2Exp:
>
>
>*-- Passed a string and a data type, return the expression after conversion to the specified data type
>FUNCTION Str2Exp( tcExp, tcType )
>  *** Convert the passed string to the passed data type
>  LOCAL luRetVal, lcType
>
>  *** Remove double quotes (if any)
>  tcExp = STRTRAN( ALLTRIM( tcExp ), CHR( 34 ), "" )
>  *** If no type passed -- display error message
>  *** the FUNCTION is not clairvoyant
>  IF TYPE( 'tcType' ) = 'C'
>    lcType = UPPER( ALLTRIM( tcType ) )
>  ELSE
>    *** Type is a required parameter. Let the developer know
>    ERROR 'Missing Parameter: Expression type is a required parameter to Str2Exp'
>  ENDIF
>  *** Convert from Character to type
>  DO CASE
>    CASE INLIST( lcType, 'I', 'N' ) AND INT( VAL( tcExp ) ) == VAL( tcExp ) && Integer
>      luRetVal = INT( VAL( tcExp ) )
>    CASE INLIST( lcType, 'N', 'Y')                      && Numeric or Currency
>      luRetVal = VAL( tcExp )
>    CASE INLIST( lcType, 'C', 'M' )                     && Character or memo
>      luRetVal = tcExp
>    CASE lcType = 'L'                                   && Logical
>      luRetVal = IIF( NOT EMPTY( tcExp ), .T., .F. )
>    CASE lcType = 'D'                                   && Date
>      luRetVal = CTOD( tcExp )
>    CASE lcType = 'T'                                   && DateTime
>      luRetVal = CTOT( tcExp )
>    OTHERWISE
>      *** There is no otherwise unless, of course, Visual FoxPro adds
>      *** a new data type. In this case, the function must be modified
>  ENDCASE
>  *** Return value as Data Type
>  RETURN luRetVal
>ENDFUNC
>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform