Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF syntax
Message
De
13/09/2015 13:49:07
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01624559
Message ID:
01624561
Vues:
76
J'aime (1)
>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'  )
>
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( ).
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform