Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Character to numeric
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00410412
Message ID:
00410441
Vues:
15
>>>Is there a way to convert a character field to a numeric field? (I need it to be numeric so there is a decimal)
>>>
>>>Thanks,
>>
>>Ryan,
>>
>>...and I'll point out the following:
CREATE CURSOR Foo (SomeNum N(7, 3))
>>m.somenum = '1234.56'
>>APPEND BLANK
>>GATHER MEMVAR && Works
>>REPLACE SomeNum WITH m.somenum && Doesn't work
Neither does insert work.
>
>I noticed this with APPEND FROM ARRAY as well.
>
>
** with the same cursor
>DIMENSION laArray(1,1)
>laArray[1,1]='1234.56'
>APPEND FROM ARRAY laArray && works
>Why does this work?

Just a SWAG, but I'd say VFP isn't doing any type checking with these commands. In the two instances I mentioned, a data type mismatch occurs. I noted some ago (late '80s/early '90s) a similar situation with the regular APPEND FROM command. I had to import an SDF file that contained a date. If you tried to do a straight APPEND at the time, the date field would always be empty. However, using a dummy table with identical field names and types, except that the date field was a character field, allowed me to first append into the dummy table, then append directly into the regular table and have the dates coverted automatically.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform