Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Export plain txt,jpegs from found and sorted record subset


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

Recommended Posts

Posted (edited)

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
Posted

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[].

Posted

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

Posted

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

This topic is 5584 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.