>>I have always used the if .. endif clause but am wondering if the IIF could serve me here. The example in help menu of VFP does not answer my question.
>>here is what I want to do using if ... endif
>>
>>
>>if myval<7
>>replace myval with int(myval)
>>else
>>? 'myval exceeds 7'
>>endif
>>
>>
>>I tried this without success - is it possible ?? (or does this function only apply to expressions) or do I just have the syntax wrong.
>>
>>? IIF(myval<7,Replace myval with Int(myval), 'Retained myval' )
>>
>
>IIF() returns either the second or third parameter as an expression, depending on the value of the first parameter. You're attempting to return a command rather than an expression.
>
>You could do something like
>
>REPLACE MyVal WITH IIF( MyVal < 7, INT( MyVal ), MyVal ) IN MyAlias
>
>but that's not a great alternative. MyVal would always be REPLACEd, even with the same value, which will affect things like GETFLDSTATE( ).
I'm curious Al why you added the 'in myalias' since ken's solution (which is virtually the same) works for me without it. Unless you were attempting to display the process as it occurs (which for me was not essential component to the operation.) Thanks for your input - I have a lot of places to use this new found knowledge.