Importing records from one file to another is a great way to keep everything local on an iPad or an iPhone. I use this technique to process updates of our iOS Solutions.
When a user checks for updates, the Solution creates a local backup on the user’s device, and the new version imports the user’s data from the backup. This keeps the user’s data private and eliminates the need to sync single-user solutions with a hosted file.
Beware File Type
Don’t make the same mistake I did; choose the right file type when mapping the import. The default File Type is “All Available”, which results in Error Code 3. The correct File Type is “FileMaker Pro Files”.
skywillmott explains how to map the import correctly. An excerpt from his post on FileMaker’s TechNet follows. (Thank you sky.)
You will need to use FileMaker Pro to set up a script to do the import when the file is used on FileMaker Go…
Firstly in the target file (the one you will be importing records into) do an import from the source file using FileMaker Pro, and make sure the field mapping is set up right…
Then create a new script that:
1. Sets up the source file path as a variable, e.g. Set Variable: $path = Get ( DocumentsPath ) & “sourcefile.fmp12”
2. Does the ‘Import Records…’ script step. When you add this to the list of script steps, it will use the field mapping from your previous import…. Make sure you also make sure the checkboxes for ‘Perform without dialog’, ‘Specifiy data source’ and ‘Specify import order’ are all on. In the options for ‘Specifiy data source’, make sure the source is set to ‘File…’ and then in the File Path List, just type in ‘$path’ and also make sure that the File Type popup menu option is set to ‘FileMaker Pro Files’!
3. Copy the sourcefile.fmp12 and targetfile.fmp12 files to FileMaker Go and open targetfile.fmp12 and run the import script to check it works… From thereon, the source file can be replaced at any time and the import re-run….
Here’s a sample file with a script that imports records to an FM Go file: LDprototype_import.fmp12. It’s best downloaded to your iPad or iPhone to test, and to your computer to analyze.
Details are available to FileMaker TechNet Members here.
See it in Action
The technique explained here is used in our own LD iOS Solutions, which are available for free download in our store.