Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
APPEND FROM inaccurate with commas in number
Message
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01311718
Message ID:
01311824
Views:
15
>It's not VFP bug because 1,234.00 is not a valid number.
>You can try to import file into excel first and than transfer data into VFP.
>
>>I have a CSV file that is downloaded from a financial institution. Etrade, to be exact.
>>
>>Some fields have values greater than 1000, and any that do use commas per traditional representation. For example: 1,234.00
>>
>>The problem is that APPEND FROM does not simply ignore the comma. Instead, VFP miscalculates the value, and the value of the field in the DBF is assigned 1.00 rather than 1234.00
>>
>>This despite the fact that the data in the file is delimited correctly.
>>
>>Is there a simple workaround for this bug?

Seems to me that if the field type is N, the APPEND code should be forgiving enough to drop commas. The data looks like this:
"TCKR","28.75","0.00","0.00%","0.00","9,600","$0.00","276,000.00","...","276,000.00",
When importing "9,600" into a numeric field, why not ignore the comma? One QaD hack thing that seems to work for this data is:
cWorkText=strtran(cEntireTextFile, [","], chr(254))
cWorkText=chrtran(cWorkText, ",", "")
cWorkText=strtran(cWorkText, chr(254), [","])
* then write cWorkText back to disk and append
Previous
Reply
Map
View

Click here to load this message in the networking platform