问题
I have a database which I want to export as an iOS compatible PLIST.
The work around I have come up with is to create a calculated field which adds the tagged padding and header and creates a report using these fields. I then export the preview of the report as a PDF, open the PDF in Acrobat Reader, select all text, copy and paste into XCode which recognises the PLIST format and all works as expected.
Is there a better way of doing this? (This seems a really convoluted way of doing things, high chance of error, etc.) The Export as XML option looks promising but I can't seem to join the dots.
回答1:
Two ways that I can think of to do what you're trying to do. The most elegant way is probably the XML with XSLT export which you suggest. If you don't already know XSLT, though, you might try the following -- it sounds like with the calculated XML line you've already created, like this would be a simple change to your database:
- Create a single new global field, say outputXML
- Create a script, say plistCreator
In the plistCreator script:
- Set outputXML to ""
- Go to the first record you want to export
- Loop through every record putting your calculated XML line into outputXML (set field outputXML to outputXML & ¶ & calculatedXMLLine)
- Go to next record, exit after last
- Export Field Contents (note that this is a different command than Export) for outputXML
回答2:
The cleanest solution is to use the export XML with an XSLT for transforming the output. You'll need to know a little XSLT to do this, or at least be able to customize the examples from FileMaker.
来源:https://stackoverflow.com/questions/6249166/filemaker-exporting-a-plist-for-ios