6 Replies Latest reply on May 2, 2013 8:52 AM by ChrisVanBuren

    Sync Dev Environment - File References




      Just trying to get my head straight on how to setup an effective development environment.


      I am going to implement a sync type solution using the FileMaker Sync Guide as a template.


      From this, the following seems clear:

      -There should be a central hosted database "central hosted" which receives the sync'd data.

      -There will be a deployed database "deployed" on the iOS device

      -There needs to be a "connector" database which is downloaded each time from a container field in "central hosted". The purpose of this is explained in the guide and is to do with closing the connection to "central hosted". This is an important file and contains the main scripts for doing the actual sync.


      That's fine for the deployed system.


      That said, I need something related but different for actual development. I would also like to have the development environment be persistent (meaning I don't want to disassemble and reassemble it when I don't need it).


      Right now I see this as:

      -"Central" - This is easy - it is just hosted and that's it.

      -"Deployed" - This is also easy - I leave a hosted database up for development purposes and hide in from Open Remote so no one but me opens it. The file references to Central are easy - just put in local (used during development) and network address (used during deployment). The file reference to connector is more complex though. If I make it local and network, the deployed database, while deployed, might access the wrong one... I can put the local ahead of the network which may solve the problem but still feels risky...

      -"Connector" - This will run local during production but, for convenience sake, I would like it hosted during development. The reference to "Central" would then also be local and network and to "Deployed" just the same... I suppose I can leave this file local on my Mac ALL the time. This way it won't exist on the FM Server and so cannot be accidentally accessed by the "deployed" databases in use. HOWEVER, this makes testing it on pain as I need to upload it into the "Central" container field every time I want to do a test on the iOS device. That said, maybe that is the best choice...


      So maybe I've just answered my own question.


      Any thoughts? What we really need is a sample database to go along with the FileMaker Sync Guide. This would then have all these details worked out. Does this exist? I have had a look and can't seem to find it. I would have thought that such a file exists as Katherine Russell (who wrote the guide) must have created a database like this before writing the guide...




      Best Regards


      Chris Van Buren


      e: chris@zeropointdata.com

      t: +44 (0)1291 689966




      Abbey Lodge, Tintern, CHEPSTOW, NP16 6SF, UK


        • 1. Re: Sync Dev Environment - File References

          Hello, Chris.


          Your Deployed file should have file references only to the connector file. This prevents the "I can't find the file" errors when the mobile device is off the grid. It should have a local file reference to the connector file.


          The Connector file should have references to the Deployed file (local) and the Central file. You can have a Dev and Prod version of the reference to the Central file, or you can repoint the reference when you move from Dev to Prod. (I recommend the latter, since it's easier to repoint a single file reference than to try to maintain a parallel set of scripts / TOs / etc.)


          When it comes time to open the Central file, you do that through the Connector file; use a script that you call from the Deployed file. Return a Script Result to let the Deployed file know if it was successful or not.





          • 2. Re: Sync Dev Environment - File References

            Thanks for your input.  Two things.


            >Your Deployed file should have file references only to the connector file.


            I think the guide says differently on page 20 in part 1.  I think the deployed file has a file reference to the hosted file but no TOs.  Only the connector file has TOs.  


            >or you can repoint the reference when you move from Dev to Prod.


            This is what I was hoping to avoid as it is sort of thing which is forgotten.  I will try to avoid it but perhaps can't be avoided...   This will need a complex checklist for deploying a new version!

            • 3. Re: Sync Dev Environment - File References

              You're correct in that the Guide does say the deployed file opens the hosted file by calling a "handshake" script. My oversight. (By "no TOs", I assume you mean no TOs referring to the hosted file.) It can be done that way; you can also do it the other way (through the connector file). Either way will work.


              So what exactly is your question? The issue of where to store the connector file?



              • 4. Re: Sync Dev Environment - File References

                I think it is all a bit clearer to me now.  I have  done the following:

                -Central file - no file references at all

                -Connector file - local reference to deployed plus remote reference.  Remote reference for development only.  Remote reference to central file

                -Deployed file - remote reference to central file.  relative path (file:FSC_Audit_Connector) for when deployed file is actually deployed and full path including my HDD etc etc for testing (as I am actually hosting the "deployed" file for testing).


                So, it's all worked out I think


                One new mystery, on page 25 of the guide, she exports the connector file from the deployed file and then opens it with:

                Open URL ["FMP://~/SyncConnector.fmp12?script=Run Sync"; No dialog]


                When use this when she could just use Open File?  When will this actually run?  What happens to the execution?  How should I then close the connector file (with Close File or won't that work).  So some more questions.  I'll post them here when I figure them out. 


                >So what exactly is your question? The issue of where to store the connector file?


                This is another question.  Seems her answer (reading closely) is i) store the file in the deployed file (this will be faster) BUT have an OnOpen script which asks the Hosted file if the connector file is still current and then downloads a replacement for itself if it isn't the most current.  How to get a file to replace itself though is still a mystery to me.  Exact words are:


                "Tip: To be sure that the sync process is running with the latest version of the connector file, you

                could add steps to the OnFileOpen script in the connector file to replace itself if a newer version

                is available from a container field in the host, before proceeding with the sync."


                I think the connector file will be tiny so I am inclined to download it everytime from the hosted file as then there are no version issues.

                • 5. Re: Sync Dev Environment - File References

                  The reason for using the Open URL method with the connector file is that it allows you to embed a script to run as a parameter (the "?script=Run Sync" part). While this could be embedded using the OnFirstWindowOpen trigger, it has big disadvantages:


                  1) It would always run whenever you opened the file, which you really don't want.

                  2) On Go, opening the file shown brings it automatically to the front, which you really don't want (because you want the sync process to be hidden).


                  With regard to the other question - how to update your connector file version - this article might be of some assistance:





                  • 6. Re: Sync Dev Environment - File References

                    Those are great tips.  Thanks.