6 Replies Latest reply on Jan 2, 2017 11:02 AM by siplus

    Import Fields not 'associating'

    synergy46

      I have a membership application and I have added fields to two tables:  DES and Milestones.

       

      I turn 'dialog' on in the script so I can see the tables and 're-associate' the names with the 'new names'.

       

      In my Milestones table this works and the fields hold their new association

      In the DES table it does not hold. 

       

      Why?

      Below is the DES table as presented:

      screen1import.png

      This is the DES table after I have 'reassociated' the names.

      screen2import.png

       

      When I do the import again, the above 'new' associations are not 'held' but instead are as in the first picture.

       

      What am I not seeing???

      Thanks

        • 1. Re: Import Fields not 'associating'
          Johan Hedman

          If you want imported records to be imported in certain order, you have to manually or via script sort your records first

          • 2. Re: Import Fields not 'associating'
            siplus

            you have 2 options.

             

            One is simply taking the correct pick from the "arrange by:" popup, i.e. "matching names".

             

            I'm not sure you want to read the second one, but here it is, in synthetic form.

             

            have a UUID in both tables, build a "importer database" having one record and one field (I like to call it pivot), link the  to be imported db by uuid = pivot, do the same with the destination db but this time set the relationship to allow creating records. You'll end up with a giant spider.

             

            In a script, using eSQL,

             

            - fetch the names of fields from source which are not globals or calcs or summaries (*)

            - fetch the uuids from the source and loop on them, setting the pivot to an element of this list

            - do a second loop on the field names from the source, getting their value and "setting field by name" in the destination table.

             

            Due to the nature of the relationship, records will be automatically created, matching values will be set and you can forget forever that stupid matching fields dialog.

             

            I do not "classically" import any more, I use this method to import. It may take longer but it can be run on dozens of databases and tables nighttime.

             

             

            (*) for how to do this I recommend this superb post:

             

            http://www.databuzz.com.au/using-executesql-to-query-the-virtual-schemasystem-tables/

            • 3. Re: Import Fields not 'associating'
              synergy46

              Johan,

              That is exactly the problem. 

              As you can see from the two screen captures in my original post, I DID reassociate the field names with the new fields.  The problem is that the associations do not 'stick'.  ie, the next time I run the script, the names are NOT associated.

              • 4. Re: Import Fields not 'associating'
                Johan Hedman

                If you use Save export order it will remember you the order your choose no matter if you add or delete fields

                • 5. Re: Import Fields not 'associating'
                  synergy46

                  importspecifyfile.png

                  Got it.  I had forgotten to specify a 'secondary file' that contained the requisite 'new' fields.  (Lodgemembership999 Copy.fmp12).  Once I did that I could associate the new fields with the tables and all worked as expected.  (What's the name of that 'memory supplement'?  I can't remember)

                  • 6. Re: Import Fields not 'associating'
                    siplus

                    Think big. Think having 100 solutions of different age at 100 different locations and having to import their data into your new version. While the destination table stays the same, the source one does not.