dogcows Posted December 26, 2005 Posted December 26, 2005 Hello there. I have what is probably a simple question and it seems a scripting question, but perhaps there is a better place to post it - if so, let me know. I have a large tab separated file with the first row being the field names. There are just under 3000 fields in the data. Each of the fields needs to be set to numeric but when I import the file, all the fields come in "text". Is there a way to automate the change in field type using a script rather than having me go through each field and change the value? Thanks in advance for your help. Josh
Reed Posted December 26, 2005 Posted December 26, 2005 It seems that you are mixing up records and fields. It's probably better to bring in the 3000 items as 3000 records rather than fields. Then you only have to change one field definition.
dogcows Posted December 26, 2005 Author Posted December 26, 2005 (edited) The data set has about 10,000 records and has 3000 fields. Edited December 26, 2005 by Guest
Raybaudi Posted December 26, 2005 Posted December 26, 2005 Then you only have to change one field definition. But he said to have a TAB delimited file, with 3000 names of fields in the first line and numeric DATA into the other lines ! He can open that file with FM, but the converted file will have 3000 text fields... and asked: how can I change those text fields to number fields (in an automatic manner)?
Raybaudi Posted December 26, 2005 Posted December 26, 2005 So the right answer is: 1) convert the file to FM 2) export as XML 3) with WORD (or another text editor)open the exported file and change every occurrence of TYPE="TEXT" to TYPE="NUMBER" and save 4)convert to FM the modified XML file P.S.: this can be made also on only one record and after import all the 10.000 records !
dogcows Posted December 26, 2005 Author Posted December 26, 2005 Raybaudi/Daniele - BINGO! You hit the nail on the head. Thanks very much for your help. That beats the pants of having to do all those by hand. For Mac users that care, I used an app called BBEdit a freeware version of which is called TextWrangler. BBEdit has been my text based data massaging app for 10 years now and hasn't failed me yet - even on huge text files. Josh
Recommended Posts
This topic is 6910 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now