Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Export plain txt,jpegs from found and sorted record subset

Featured Replies

I am trying to create a database to store content for a Flash file that will load the .txt and JPEG files into itself. I know data will be continually added to the content database, so my goal is to simply create records with date fields to order the records by, and site section names to find the records belonging together.

I have created records with text and container fields.

I would like to be able to find by section, sort ascending by record date and then have my script export my text and image container field contents to txt and JPEG files with names I specify in the script for each field and sequential numbers based on the record sort order. Example:

field titleText (text) would be exported as plain text with the name titleText_[n].txt, where n is the sequential record count number.

So far, I am running into two issues - I am unable to get filemaker to export a text file with just the text I had entered into the field - it inserts other characters x00 and xFF˛ - no idea what those are or how to make them go away... The text in my text fields was copied and pasted into FM Pro from BBEdit, so I am certain those characters weren't in the original text... I can use BBEdit to remove the characters from the exported files, but I am certain there is a way to get FM to never put them there...

The second issue I am having is - I can't get filemaker to use my iteration variable in the filename. I have used Set Variable to create a variable $iteration with an initial value of 0. When I then tell Fm Pro to Export Field Contents and Specify Output File as follows: file:press/text/titleText_$iteration.txt - it calls the file titleText_$iteration.txt instead of titleText_0.txt, or whatever the iteration number would have been.

Apologies to any responders - I am an ActionScript programmer so I haven't figured out the FM Pro scripting syntax yet... I am finding the help documentation a bit cryptic - any recommendation for literature about FM Pro scripting is most welcome.

And of course I haven't figured out how to get FM Pro to move on to the next found record after exporting the current record - I have attempted to create a second variable, $endIteration with the value Get(FoundCount) and creating a Loop that stops repeating when $iteration and $endIteration-1 are the same, but my syntax must be off because it never repeats at all - or if it repeats, it doesn't step to the next record so I don't know it repeated because it is exporting the same record for the $endIteration-1 number of times...

I can include my fm file or script for someone to look at - don't know how to get to the plain text version of the FM script.... Guess I could post the whole file if it would help...

Thanks in advance,

MAnca

Edited by Guest

Your script should look very much like the example here:

http://fmforums.com/forum/showpost.php?post/218603/

except you would use Get (RecordNumber) instead of the SerialID field.

Re your first issue: when you use Export Field Contents [] with a text field, the resulting file is encoded as UTF-16. Unfortunately, there's no way to change this. If your target application cannot handle UTF-16, you will need to either post-process the file or use some other method - for example, isolate the current record and export it using Export Records[].

  • Author

OK, resolved how to Loop until condition met.

Resolved how to pass variable into file name.

Still getting those foreign characters in my txt files though. Any help with that would be much appreciated.

Thanks

MAnca

  • Author

It appears my Flash application doesn't mind those extra chars - must be the text encoding that BBedit 6 doesn't like. Maybe I need to upgrade to the last version of BBedit (9)...

Thanks for your response

MAnca

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.