Jump to content
Server Maintenance This Week. ×

Exporting a Column of Numbers from a Text Field


This topic is 2334 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Suppose I have a column of numbers in a text field and I wish to export that field.  What happens is that only the last number of the column gets exported.  If, on the other hand, I separate each number by a comma, one after the other (not in a column), the export function works:  all numbers are exported.  The problem is that some other applications cannot easily read a comma-delimited text file--they prefer to read a column of numbers.  So:  is there any way to export a column of numbers (contained within one text field) to the disk?

Link to comment
Share on other sites

With FMPA14, all the numbers in the field are exported.

What are you reading the exported file with? If you used Export Records on a found set of one record, the numbers are exported with a vertical tab (code 11) separating them, which your target program may read incorrectly.

Filling out your profile will help us help you further.

Link to comment
Share on other sites

Using FileMaker 11 Advanced, I'm exporting a single text field (via script) to disk to be read by True BASIC, which I'm using as a back end (because of the complexity of the math).  I updated my profile, as requested.

I'm using "type file.txt" from the command prompt; the result is just one number.  But if I load the file into Notepad, I get the row of numbers. This whole thing is very strange

Edited by transpower
Link to comment
Share on other sites

Did you look at the output text file with a straight text editor such as TextEdit or TextWrangler? I used the Export Field Contents script command and once again saw all the numbers in the original field.

Link to comment
Share on other sites

After some more hours of experimenting, I see that FM is exporting the field as MAC format UTF-16LE (as verified in EditPad Lite 7).  The "type" command will not work properly with that format--nor will my back-end program.  What I need in Windows is US 7-bit ASCII text format!

Edited by transpower
Link to comment
Share on other sites

Fenton's answer is for Mac, not Windows, and UTF-8 will not work--only ASCII.  After some more hours of searching, I found iconv_for_windows, which can, in fact, convert UTF-16LE to ASCII.  Then, I have to apply sed_for_windows to fix the line-endings.  I think that FM should provide a patch for all versions from 7 to the present to allow the specification of the encoding for the resultant text export--like Windows ASCII.

Link to comment
Share on other sites

OK, so now I have the export working and the Send Event script step which runs a Windows batch file to take the exported field and change it to Win ASCII and  run the True BASIC program to get the output (in an ASCII file, of course).  Now I went back into the script editor, and lo and not behold there is no script step to import a file into a field (a text field in my case).  So now what???  What am I missing?  Why would FM have an Export Field step but not an Import field step?

 

Ah, I now see the Insert File script step--let's see how this does!  Well it doesn't--and least not yet.  I've tried text, calculation, and container as the aspect of the importing field--none work so far.  If I use the "reference only" option and make sure the file has a .txt exention, FM will provide an arrow in the container field so that one can click on that and Notepad will open--displaying the data.  But that's kind of a nuisance--I want the numbers directly displayed in the field.

OK, this morning I added a line to the batch routine:  type myfile.txt | clip.  Then in the FM script I navigate to the importing field, select all, and paste.  And voila the text is there!  So, all's well that ends well.  Still, FM needs to revise the Export Field script step to export to a Windows ASCII file and FM should add an Import Field script step to import from a Windows ASCII file

Edited by transpower
Link to comment
Share on other sites

This topic is 2334 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.