Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIF syntax
Message
From
13/09/2015 14:49:19
 
 
To
13/09/2015 13:50:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01624559
Message ID:
01624563
Views:
46
>>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) && I want to remove values to the right of the decimal
>>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'  )
>>
>
>Hi Karen,
>
>Try This:
>
>
>REPLACE myval WITH IIF(myval < 7, INT(myval), myval)
>
>
>Hope this helps
>
>Ken

Oh wow!! Definitely going to write that one down. Thanks a lot Ken. It works beautifully.
Previous
Reply
Map
View

Click here to load this message in the networking platform