FileMaker 17: Data Migration Tool - Part Four

FileMaker 17: Data Migration Tool - Part Four

Putting it all together

Colin Keefe, FileMaker Consultant, IT Solutions 

Through this mini-series of articles we've tried to help identify where the Data Migration Tool fits into the problem space of managing FileMaker deployments, by outlining: 

  • What DMT does 
  • How to script it 
  • Some practical deployment considerations that surround using a tool like DMT 

In this final article we're going to circle back to scripting the DMT with an eye to helping manage the deployment process.  To follow along, download your copy of the DMT Helper File:

Download your copy of the DMT-Helper Sample File 

In this scenario we imagine a development team that must manage deployments for several FileMaker apps, each of which may contain one or more FileMaker files, each with their own settings. To keep it simple, we're going to ignore security considerations and store account names/passwords and encryption keys in the file we're creating. One way to mitigate security concerns is to use special extended privileges to allow non-Admin accounts to manage migrations. 

We're going to build out a tool that manages a multiple-file migration, and stores the migration settings for separate client solutions. Some core user stories are: 

Here are some sample screens from our scenario:

Solution Profile Management Screen

Here we have a list of solutions on the upper left, and a list of files for each.  No solutions have been created yet.

Clicking an Add button lets the user add a New Solution, with a few fields

This creates a new record as shown:

Once we add required fields, we should be able to run a migration on the selected file:

Then when we run the migration, we want to see the last run time, the result and output, something like this:

We ought to be able to add another file, as shown, and have its own run/result values.

This allows us to run migrations in batch, and then see individual pass/fail results.  In the example below, the first file had incorrect authentication supplied, and so it failed, but the second was fine.


With this suggested model, you could store Migration Profiles for multiple clients, as shown:


Scripting in depth
Here's the script that does the individual DMT calls.  It does a few things:

  • We use JSON to pass parameters to this script, so we specify what the script expects in a comment at the top.
  • We capture the JSON
  • We build a terminal command line instruction based on the supplied parameter values
  • We determine what OS we're running under and make the appropriate external event call
  • We capture the result and update the FileMaker record with it.  On the Mac this is easy - just use AppleScript.  On Windows we resort to some trickery.

Note that this file is dumb in the sense that it assumes all files are in the same directory as the DataMigrationToolHelper file.  Feel free to make it smarter!


#-------------------------------<br /> #10/24/17 Colin Keefe, IT Solutions Consulting, Inc.<br /> #2/20/18 Robin Story, IT Solutions Consulting, Inc. (added Windows scripting)<br /> #<a href="" target="_blank"></a>

#Parameters to supply to this script:
#JSONSetElement(""; // source ["src_path"; MigrationProfile::src_path; ""]; ["src_account"; MigrationProfile::src_account; ""]; ["src_pwd"; MigrationProfile::src_pwd; ""]; ["src_key"; MigrationProfile::src_key; ""]; //clone ["clone_path"; MigrationProfile::clone_path; ""]; ["clone_account"; MigrationProfile::clone_account; ""]; ["clone_pwd"; MigrationProfile::clone_pwd; ""]; ["clone_key"; MigrationProfile::clone_key; ""]; ["target_path"; MigrationProfile::target_path; ""]; ["ignore_valuelists"; MigrationProfile::ignore_valuelists; JSONString]; ["ignore_accounts"; MigrationProfile::ignore_accounts; JSONString]; ["mode"; MigrationProfile::mode; JSONString]; ["cache_size"; MigrationProfile::cache_size; JSONString]; ["opl"; MigrationProfile::opl; JSONString] )
Set Error Capture [ On ]
Commit Records/Requests [ No dialog ]
#export FMDataMigration Tool to Temp Directory
If [ IsEmpty (Get(ScriptParameter) ) ]
Show Custom Dialog [ Title: "Error"; Message: "No parameters were supplied. Please see script documentation to learn how to pass required parameters to this script."; Default Button: “OK”, Commit: “No” ]
Exit Script [ ]
End If
# 2/12/18 RHS - Let's create a variable to store if this is windows or mac
Set Variable [ $isMac; Value:Get(SystemPlatform) = 1 ]
#This is dumb in the sense that it doesn't understand relative file paths - it assumes all files are in the same directory as the current file. 10/24/17 CK
If [ $isMac ]
Set Variable [ $q; Value:"'" ]
Set Variable [ $tmp; Value:Get(FilePath) & "FMDataMigrationTool/FMDataMigration" ]
Set Variable [ $scriptLocation; Value:"'" & Substitute($tmp; ["file:/Macintosh HD";""];[Get(FileName);""];[".fmp12";""]) & "'" ]
Set Variable [ $filesLocation; Value:Substitute(Get(FilePath); ["file:/Macintosh HD";""];[Get(FileName);""];[".fmp12";""]) ]
# reset the result sniffers
Set Field [ MigrationProfile::Result; "" ]
Set Field [ MigrationProfile::win_container_result; "" ]
Export Field Contents [ “file:result.txt”; Create directories:No ]

Set Variable [ $q; Value:""" ]

© 2020 IT Solutions Consulting, Inc.. All rights reserved. Privacy Statement  |  Site Map