12 Replies Latest reply on May 23, 2013 1:39 PM by bterrell721

    Export/Import for record merge on iPad

    bterrell721

      Title

      Export/Import for record merge on iPad

      Post

           Hello All,

           I have built a client information storage database and, to make the issue very short, am trying to write a script that can merge two records that may have accidentally been created for the same client.  I understand that the best way to do this is to export the record you want to merge, then import the data back into the file in a second temporary table and then compare each field and copy over the fields you want to merge into the duplicate record.  This is working perfectly on my desktop, however when I try to execute the script on the iPad it is not seemingly able to import the records I exported.  My export script uses a variable $$path as the file which looks like:

           "file:" & Get ( TemporaryPath ) & "Merge.mer"

           I then run the import script afterwards using the same variable, and although no errors are thrown (as in the file could not be found), no records are imported into the temporary table.  I have tried with various file types (although I have been lead to believe that since I can't use .fmp files on an iPad, .mer would work just fine) and still no success.  I am at a bit of a loss here since I am not getting any errors on either the export or the import, it simply isn't executing.  I can relatively confidently confirm it is exporting properly, as I get the export dialogue and it executes when I run that script, but I am not even getting a dialogue for the import script, it skips it completely.  Any insight would be greatly appreciated, thanks!

            

        • 1. Re: Export/Import for record merge on iPad
          TSGal

               Brandon Terrell:

               Thank you for your post.

               FileMaker Go can only import FileMaker Pro files.  Therefore, yoiu may want to import the record from the same file.  That is,

               "file:" & Get ( TemporaryPath ) & "test.fmp12"

               For more about Import Records in FileMaker Go, please see "Importing to and from a transferred file" beginning on page 7 of the FileMaker Go 12 Development Guide at:

          http://www.filemaker.com/support/product/docs/12/filemaker-go/fmgo_development.pdf

               Please let me know if you need additional clarification.

               TSGal
               FileMaker, Inc.

          • 2. Re: Export/Import for record merge on iPad
            bterrell721

                 Okay well that makes sense.  "file:" & Get ( TemporaryPath ) & "myfile.fmp12"  would be the location where the hosted file is stored on the iPad?  

            So then in my script, once I navigate to the temporary table and layout I need to import into, how do I run an import that brings in data from a particular record in that same file?  As in, where do I specify what specific table and record I want to be importing data from?  I know that Filemaker Go can't export into .fmp12 format, but since it can only import that format I am unclear how to specify the data I want the import script step to bring in if I am trying to bring it in from the same file I am importing to.

            • 3. Re: Export/Import for record merge on iPad
              TSGal

                   Brandon Terrell:

                   Yes, the location would be the local file on the iPad.

                   In FileMaker Pro, create the import setup, so you know which table to import along with the fields to import.  Then, replace the specific file name with the variable.

                   TSGal
                   FileMaker, Inc.

              • 4. Re: Export/Import for record merge on iPad
                bterrell721

                     Yes, I don't have an issue scripting the import with the table and fields I want, my question is how do I specify that I only want to import the data from a single record within that source table?

                • 5. Re: Export/Import for record merge on iPad
                  TSGal

                       Brandon Terrell:

                       If the script is set to import from a specific file and table, it will import the found set of records.  Therefore, if the file has a found set for a single record, only the single record will be imported.  Does that make sense?

                       TSGal
                       FileMaker, Inc.

                  • 6. Re: Export/Import for record merge on iPad
                    bterrell721

                         It does, and thank you very much for taking the time to spell this out for me.  My next question then is since I am importing into a table in the same file that I am importing from, after I do a search to narrow it down to the single record in the source table, when I switch layouts/tables to the target table for the import script step will it preserve the single-record found set I established in the source table so that it only grabs the data from the one record I wanted?  Is there a particular option I need to enable to make sure that found set remains for the import or does it natively keep the records omitted when you swap tables in a file?

                    • 7. Re: Export/Import for record merge on iPad
                      TSGal

                           Brandon Terrell:

                           Yes.  If the file has a search criteria in one table, and you switch to another table and import, it will respect the search criteria and import the found set.

                           TSGal
                           FileMaker, Inc.

                      • 8. Re: Export/Import for record merge on iPad
                        bterrell721

                             Still no luck on this one.  I had to modify the $path variable to account for the fact that the location on a desktop would be different than on the iPad and came up with:

                             If ( PatternCount ( Get ( ApplicationVersion ) ; "iPad" ) ; "file:" & Get ( TemporaryPath ) & "MyFile.fmp12" ; "file:MyFile.fmp12" )

                             Should work fine, and it executes perfectly on the desktop.  When I run it on the iPad however, it still doesn't import any data but also isn't giving me any errors, so I can only assume it has to be having some kind of issue on the import script step.  I specified the import file type as Filemaker Pro Files, didn't make a difference.   Any other ideas?  Thank you again for taking the time to try and work this out with me.

                        • 9. Re: Export/Import for record merge on iPad
                          TSGal

                               Brandon Terrell:

                               Make sure the correct value is being stored.  That is, place the variable into a temporary Text field so you can see the value.  Place some Pause script steps so you can verify the script.  Also, you may want to put the LastError code into a field so  you know what is the cause.

                               TSGal
                               FileMaker, Inc.

                          • 10. Re: Export/Import for record merge on iPad
                            bterrell721

                                 The path I get is a crazy temporary path that I am assuming the GO app uses to store the file locally, which is what it should be I think?

                                 file:/private/var/mobile/Applications/<Long Alphanumeric String>/tmp/S15/MyFile.fmp12

                                 After I run the import script though it does throw error 100 (file not found), so apparently it isn't able to locate itself at that path.

                                 Any more ideas on how I might get this thing pointed to the right place?

                            • 11. Re: Export/Import for record merge on iPad
                              TSGal

                                   Brandon Terrell:

                                   Here are the exact steps I took:

                                   1. The first line of my script should be straight-forward:

                                   Set Variable [ $file ;  Value: "file:" & Get ( TempoaryPath ) & "MyFile.fmp12" ]

                                   2. I then added the Import Records script step, where I checked the option for "Perform without dialog", I specified the data source as file:MyFile.fmp12, and then specified the import order.

                                   3. Once the import order was fixed, I moved the "file:MyFile.fmp12" reference to the second position, and in the first position, I placed "$file".  This keeps the specified import order.

                                   4. My script step now shows:

                                   Import Records [ No dialog ; "$file" ; Add; Mac Roman ]

                                   ... even though the "file:MyFile.fmp12" line isn't listed.

                                   5. I then copy the file to the iOS device, launch FileMaker Go, and execute the script.

                                   If you still get the error message, make sure your filename doesn't have leading or trailing spaces.

                                   Continue to keep me updated with any progress.

                                   TSGal
                                   FileMaker, INc.

                              • 12. Re: Export/Import for record merge on iPad
                                bterrell721

                                     Success!

                                     Finally, thank you so much for holding my hand through this one TSGal.  smiley