Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Value from string
Message
De
27/09/2007 12:27:42
 
 
À
27/09/2007 12:24:28
Joel Hokanson
Services Integration Group
Bellaire, Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01257239
Message ID:
01257243
Vues:
20
>When I import from a CSV file then try to convert a string to a value, it seems to round it off.
>
>use ar
>APPEND FROM ar.csv csv
>
>I have a field called balance and if it is a Char field, then the number imports fine
>I get 4,464.25 left justified
>
>If I use numeric or currency I get 4.00
>
>So I want to convert character 4,464.25 left justified to a number
>If I use Val(Balance) if get 4.00
>
>I would think it has to do with Rounding but I can not seem to make it work right???
>
>Thanks
>Joel in Houston

No, the problem is the "," (comma). VAL() stops at the first non-numeric character, only 0-9, sign (+/-) and decimal point are valid.

You'll have to import this in two steps, one as the character field with the comma, and then a second step that transfers the character field and translates the comma to nothing into a numeric field.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform