« PostgreSQL Libraries … | Home | Improvements for MBS … »

Split XML for DDR into files for GIT

Did you know you can use XML functions in MBS FileMaker Plugin to split your Database Design Report XML files into smaller XML files and put them in a GIT repository?

First you can use FM.RunDatabaseDesignReport function in our plugin to trigger FileMaker to create a DDR by script. Or you use AppleScript for GUI scripting as you can see in this older blog post: Automate creation of Database Design Reports in FileMaker. For FM.RunDatabaseDesignReport, here is an example line:

MBS( "FM.RunDatabaseDesignReport"; 1 /* XML */; "/Users/cs/Desktop"; 0; "Anlagen.fmp12" )

First parameter is 1 to enable XML. Second parameter is folder path, but that is ignored on Windows or macOS Catalina, so please manually make a XML first and point to desktop, so you have always the same folder. Next parameter allows to not open the file and last parameter is to select which files to use for DDR.

Once you have a XML, you may want to split it to put it in version tracking. We got a sample script for next plugin for you. We use Text.ReadTextFile to read the XML file, then use XML.SubTree to get the XML. We loop over all the XML nodes with XML.NodeNames, use XML.SubTree again to get the part and write it to a new XML file. This gives you all the XML files on the top level on the right picture.

Next we did walk over layouts, scripts, tables and themes to write individual files for each item. This includes calling a script for each type to walk over the nodes and write them in files. If there is a group, we can create a folder and call the script again with output going to the new folder. To pass arguments we use JSON to pass XML block and path.

Once you regularly start to write those XML files automatically for all your databases into folders and check them in to GIT or any other version tracking, you can keep track of changes on the databases over times.

The file Split DDR.fmp12 will be included with next 10.4pr1 in a few days. Please do not hesitate to contact us with your questions.
27 07 20 - 08:26