Jump to content
Sign in to follow this  
Sergeant Ron

formatting text for to include a carrige return for export to .txt file

Recommended Posts

Sorry for the long title but there was no other way to explain it. I have a field called Findaddress. This file is formed by concatenating two other fields. StreetNumber and StreetName. The result via script will then be output to a file called FindAddress.txt. Now here is the issue im having, I need the result to be for example: 123,Main Street. This should be followed by a carriage return

Share this post


Link to post
Share on other sites

when I output this result to my .txt file there is no carriage return.

You didn't mention exactly how you were outputting the data to the text file, but I am going to guess that you are using a standard FileMaker export. If that is the case, then you are seeing the expected behavior. Exported records are delimited from each other by a carriage return, so a return in a field would break an exported record into two records. If FileMaker didn't strip returns from field data, the export feature would be pretty useless.

They are a bunch of ways to solve your problem. The one that is right for you depends on your situation:

- Loop through the records compiling all the data into a single global field and then use the Export Field Contents script step. Possible issues: I have had trouble with this in the past because the resulting file is encoded as UTF-16. Not sure if this matters in your case.

- If the FileMaker file is hosted on FileMaker Server, you can pull the address data using PHP, format it however you like, and email the file to yourself. Possible issues: Workflow is sort of wonky and requires writing some PHP.

- If you are on a Mac, you can use AppleScript to pull the data and create the file. I believe I have an example of that in this sample file.

I am sure there are a bunch of other, better solutions, but those are the ones off the top of my head.

HTH,

j

Share this post


Link to post
Share on other sites

The best way, IMHO, is to export as XML using a custom stylesheet:

http://fmforums.com/forum/showtopic.php?tid/193820/post/283979/#283979

But see also a potential bug affecting Windows:

http://fmforums.com/forum/showtopic.php?tid/191976/post/305702/#305702

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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