General information
Category:
Coding, syntax & commands
>Hi,
>
>In my application, I have a text file that I have to slice, dice and reformat. I have created the table to import the text file into and have created the required fields.
>
>Here's my problem - I'm not sure how to convert the text dollar amounts (i.e. 22,000,000.00) into a text dollar amount (i.e. 22000000.00) so that I can use the val function to convert it to a numeric value. Is there an relatively simple way to do this? The text file has about 10,000 records.
>
>Thanks.
Create the amount field as character and import the text file. After that, insert a new numeric field, and do a REPLACE ALL command transfering and converting the data in the character field to the numeric field, using VAL(STRTRAN(charfield,",")).
REPLACE ALL numfield WITH VAL(STRTRAN(charfield,","))
(You can also open the text file using Excel, change the format for the columns and save it as a .DBF. In VFP, open the table and rename the fields. Then use APPEND FROM. Excel is very good for dealing with text conversion.)
Good Luck!
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only