4 Replies Latest reply on Feb 10, 2012 2:42 AM by RayCologon

    Import options featurebug

    DavidJondreau

      I'm doing a conversion (from 2.0!). I've converted the 2.0 file to 6 then to 11. I've created an Import file in which all my importing logic takes place (scripts, TOs, extra fields etc). I import the data from the old file into the import file. Then I import those records into the local TOs of new database using the new db as an external data source.

       

      I've run into one glitch though.

       

      When importing into one particular table, I can add new records, but both options to update are grayed out. I think it's because there are no records in the table yet. This is annoying because I'm writing a script to Import the table twice. Once to move the PK over (with no auto enter option) and non-auto entered data over, then again to update the keys.

       

      I assume Filemaker is trying to be helpful, but it's just annoying.

       

      My first world problem for the day.

        • 1. Re: Import options featurebug
          karendweaver

          Hi David!!

           

          Yes you are right - I have run across this before.  FileMaker thinks you can't update if no records are present.  So annoying.

           

          I have solved this by creating ONE "dummy" record - no data, in each file I am importing.  Then I can import/update no problem, and I delete the dummy at the end of the script..

           

          I think it is worth it to create the dummy records (do this BEFORE creating the scripted imports) if you are doing lots of importing, since then you don't have to do mulitple imports.

           

          warm regards,

           

          Karen

          • 2. Re: Import options featurebug
            DavidJondreau

            Karen,

            Thanks for confirming that.

             

            Missed you on Tuesday at the Uptown! Hopefully next month.

             

            David

            • 3. Re: Import options featurebug
              karendweaver

              Yes I was bummed.  Had to cancel at the last minute - too many deadlines.  Next month for sure.  I don't miss many!

               

               

              Karen

              • 4. Re: Import options featurebug
                RayCologon

                DavidJondreau wrote:

                When importing into one particular table, I can add new records, but both options to update are grayed out. I think it's because there are no records in the table yet. This is annoying because I'm writing a script to Import the table...

                 

                Hi David,

                 

                What you're seeing is a non-issue at runtime - ie an "update existing" script will run and will work correctly whether or not there are records in the target table when it runs. The fact that the update import options are grayed out if there are no records is a consequence of the fact that the script editor interface is using the standard import dialog (which is state aware) and simply capturing the settings rather than applying them.

                 

                So, you won't need any dummy records in the file you're importing, and you only need to create a record in the target table temporarily while defining the import order in the script, then you can delete it immediately after. The scripted update import will then run correctly whether or not there are records present when the step executes.

                 

                This is one of a number of consequences arising from the use of standard dialogs to configure script attributes. For example, a similar scenario arises when using a local variable to supply a path for a file import - because the local variable isn't instantiated when defining the import order for the script, the Import dialog can't "see" the source file structure, so you have to temporarily hard code an explicit source file path, just while setting the import order. The explicit path can be removed - or simply left below the variable name (where it becomes redundant) once the import order is in place.

                 

                Regards,

                Ray

                ------------------------------------------------

                R J Cologon, Ph.D.

                FileMaker Certified Developer

                Author, FileMaker Pro 10 Bible

                NightWing Enterprises, Melbourne, Australia

                http://www.nightwingenterprises.com

                ------------------------------------------------