3 Replies Latest reply on Dec 20, 2011 8:03 AM by JeffPenner

    Scripted upgrade/import

    arthursc

      Hello,

       

      Could someone be able to supply a simple script that a "not too techie" could basterdise to import data from one FM solution into another with exactly the same tables and fields?

       

      Kind Regards

      Colin

        • 1. Re: Scripted upgrade/import
          beverly

          Well, Colin, your fields could be different from my fields, so you still have to set up the script step "Import" and specify the fields.

           

          Remember to "find" (or findall) the records in the "export" table (a script is located there). Then used the Import script step in the "to" table to perform that action.

           

          You don't specify WHERE these two tables are located, so you may have some variance and/or you may have to used real "Export" (as some data type) to a file and Import into the second file.

           

          Beverly

          • 2. Re: Scripted upgrade/import
            taylorsharpe

            Does the other file already exist?  If not, then just do  Save A Copy As and you'll get an exact copy with fields and all.  FileMaker does not let you natively use the scripting image to alter schema (add, change, delete fields, etc). However there is a plugin called MMQuery that can do this.  If you know the fields are the same, it is easy.  But to wrie a script that compares tables and fields and makes changes accordingly is possible, but would not be a simple script.

             

            You can use FieMaker to copy and paste many things like fields and scripts, but not others like value lists or whole layouts.  Some things can only be copied if you have FileMaker Advanced, but it does help. 

            • 3. Re: Scripted upgrade/import
              JeffPenner

              Hi Colin,

               

              In addition to what's already been mentioned, here's samples from a script I

              use.  I use it all the time my client couldn't wait until the db was

              complete before she started using it, so I end up importing all their data

              into an empty clone about once a week.

               

              Show Custom Dialog ["Warning!"; "This will add all records from Database.fp7

              to the current databaseŠProceed with update?"; Buttons: "No"; "Yes"]

              If

              Import Records [No dialog; "Database.fp7"; Add; Mac Roman]

              Go to Layout ["All Contacts" (CONTACTS)]

              Set Next Serial Value CONTACTS::__kp_ID; CONTACTS::_Max_kp_ID + 1

               

              And the script keeps going through every table in the solution in more or

              less the same way.  Of course, as Beverly mentioned, you still have to set

              up your Import Records script steps to match the tables in your solution.

               

              HTH,

               

              Jeff Penner

              Aspen Lane Technology

              Bus. 877-381-0692 Mobile 204-381-0692

              jeff@aspenlane.ca

               

               

              From:  user7471 <noreply@filemaker.com>

              Reply-To:  <fmi-1223433073-3vv-2-1eft@fmdev.filemaker.com>

              Date:  Tue, 20 Dec 2011 07:22:56 -0800

              To:  Jeff Penner <jeff@aspenlane.ca>

              Subject:  Re: Scripted upgrade/import

               

              <https://fmdev.filemaker.com/index.jspa>

              created by user7471 <https://fmdev.filemaker.com/people/user7471>  in

              Scripting and Calculations - View the full discussion

              <https://fmdev.filemaker.com/message/65369#65369>

               

              Does the other file already exist?  If not, then just do  Save A Copy As and

              you'll get an exact copy with fields and all.  FileMaker does not let you

              natively use the scripting image to alter schema (add, change, delete

              fields, etc). However there is a plugin called MMQuery that can do this.  If

              you know the fields are the same, it is easy.  But to wrie a script that

              compares tables and fields and makes changes accordingly is possible, but

              would not be a simple script. You can use FieMaker to copy and paste many

              things like fields and scripts, but not others like value lists or whole

              layouts.  Some things can only be copied if you have FileMaker Advanced, but

              it does help. 

              Reply to this message by replying to this email -or- go to the message on

              FileMaker Technical Network

              <https://fmdev.filemaker.com/message/65369#65369> Start a new discussion in

              Scripting and Calculations by email

              <mailto:discussions-community-discuss-scripting_and_calculations@fmdev.filem

              aker.com>  or at FileMaker Technical Network

              <https://fmdev.filemaker.com/choose-container!input.jspa?contentType=1&conta

              inerType=14&container=2035>

                                      Manage your email preferences

              <https://fmdev.filemaker.com/index.jspa/user-notification-preferences!input.

              jspa> .

               

              FileMaker Developer Conference 2012 € Miami, Florida € July 16-18 €

              www.filemaker.com/devcon