Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making value to be of currency type
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
MS SQL Server
Divers
Thread ID:
01636253
Message ID:
01636257
Vues:
44
>>Hi everybody,
>>
>>Suppose I pass a value this way
>>
>>'555.55' (as part of the longer string) and pass its type as 'Y'.
>>
>>I need to make that string value to be returned as currency value in this case and be correctly passed as currency to other methods (so vartype will detect it as currency).
>>
>>I did a quick test in the command window:
>>
>>
>>val = $555.55
>>=MESSAGEBOX(VARTYPE(val))
>>
>>So, it worked, but I want it to be universal. Also, it should not depend on the default language/currency format settings.
>>
>>So, may be I should try just casting the value as Y to pass back?
>>
>>Thanks in advance.
>
>It works for me, and my default language is Bulgarian and currency is лв. :-)

I think CAST will be safer.

This is part of our 'Parse' method code:
CASE tcType == "N"
            lvRetVal = VAL(lvRetVal)
            ** FP# 15356 - Strip decimals if there is no remainder
            lvRetVal = IIF(lvRetVal % 1 = 0, INT(lvRetVal), lvRetVal)
There is no 'Y' case currently and I'd like to add it.

Thanks.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform