Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Split DDR

All examples are included with download of MBS FileMaker Plugin.

Split DDR.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts7
Value Lists0
Custom Functions0
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
SplitXML
6 fields defined, 1 record
SplitXML

Fields

Table Name: SplitXML - 6 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
PrimärschlüsselNormal, TextAuto-Enter:
  • Context table: SplitXML
    Calculation: Get( UUID )
Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Eindeutige ID für jeden Datensatz in dieser Tabelle
          ErstellungszeitstempelNormal, TimestampAuto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Datum und Uhrzeit der Erstellung der einzelnen Datensätze
                  ErstelltVonNormal, TextAuto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Kontoname des Benutzers, der die einzelnen Datensätze erstellt hat
                          ÄnderungszeitstempelNormal, TimestampAuto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Datum und Uhrzeit der letzten Änderung der einzelnen Datensätze
                                  GeändertVonNormal, TextAuto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Kontoname des Benutzers, der die einzelnen Datensätze zuletzt geändert hat
                                          XMLNormal, TextAuto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German

                                              Layout Objects: SplitXML

                                              Regular Fields

                                              Field Name: SplitXML::XML
                                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                              • Top: 52 pt
                                              • Left: 138 pt
                                              • Bottom: 524 pt
                                              • Right: 1015 pt
                                              • Anchoring: Left, Top
                                              Field Format:
                                              • Edit Box
                                              Field Behavior:
                                              • Allow field to be entered: In Find mode, In Browse mode
                                              • Touch keyboard type: Default for Data Type
                                              • Go to next field using: Tab key
                                              Yes

                                              Script Hierarchy

                                              Make DDR
                                              Split
                                              SplitLayouts
                                              SplitScripts
                                              SplitThemes
                                              SplitBasetables
                                              Clear

                                              Next Script: [Split]
                                              Script NameMake DDR
                                              Run script with full access privilegesOff
                                              Include In MenuYes
                                              Layouts that use this script
                                                Scripts that use this script
                                                  Script Definition
                                                  Script Steps
                                                  • #create DDR
                                                  • #enable XML
                                                  • #Destination path may be ignored on Windows and macOS Catalina, so make manually a DDR and set path
                                                  • #Don't open
                                                  • #File Names can specify which files to select in dialog
                                                  • Set Variable [ $r; Value:MBS( "FM.RunDatabaseDesignReport"; 1 /* XML */; "/Users/cs/Desktop"; 0; "Anlagen.fmp12" ) ]
                                                  Fields used in this script
                                                    Scripts used in this script
                                                      Layouts used in this script
                                                        Tables used in this script
                                                          Table occurrences used by this script
                                                            Custom Functions used by this script
                                                              Custom menu set used by this script

                                                                Previous Script: [Make DDR]Next Script: [SplitLayouts]
                                                                Script NameSplit
                                                                Run script with full access privilegesOff
                                                                Include In MenuYes
                                                                Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • #Change paths to point to the XML file and the folder to create
                                                                    • Set Variable [ $path; Value:"/Users/cs/Desktop/Anlagen_fmp12.xml" ]
                                                                    • Set Variable [ $folder; Value:"/Users/cs/Desktop/Files" ]
                                                                    • #read XML
                                                                    • Set Variable [ $xml; Value:MBS( "Text.ReadTextFile"; $path; "UTF-16") ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed to read XML file."; Message: $xml; Default Button: “OK”, Commit: “Yes” ]
                                                                    • Exit Script [ Result: $xml ]
                                                                    • End If
                                                                    • #get the inner part
                                                                    • Set Variable [ $xml; Value:MBS( "XML.SubTree"; $xml; "File") ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed to parse XML file."; Message: $xml; Default Button: “OK”, Commit: “Yes” ]
                                                                    • Exit Script [ Result: $xml ]
                                                                    • End If
                                                                    • #create output folder
                                                                    • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $folder) ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed to create directory."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                    • Exit Script [ Result: $r ]
                                                                    • End If
                                                                    • #walk over nodes
                                                                    • Set Variable [ $names; Value:MBS( "XML.NodeNames"; $XML) ]
                                                                    • Set Variable [ $count; Value:ValueCount($names) ]
                                                                    • If [ $count > 0 ]
                                                                    • Set Variable [ $index; Value:1 ]
                                                                    • If [ $index ≤ $count ]
                                                                    • Loop
                                                                    • #your script steps here
                                                                    • Set Variable [ $name; Value:GetValue($names; $index) ]
                                                                    • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; $name) ]
                                                                    • #write the whole thing
                                                                    • Set Variable [ $p; Value:MBS( "Path.AddPathComponent"; $Folder; $name & ".xml") ]
                                                                    • Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; $x; $p; "UTF-8") ]
                                                                    • #Check for writing some parts, we have more interest in
                                                                    • If [ $name = "LayoutCatalog" ]
                                                                    • Set Variable [ $p; Value:MBS( "Path.AddPathComponent"; $Folder; "Layouts") ]
                                                                    • Perform Script [ “SplitLayouts”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $p; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                    • Else If [ $name = "ThemeCatalog" ]
                                                                    • Set Variable [ $p; Value:MBS( "Path.AddPathComponent"; $Folder; "Themes") ]
                                                                    • Perform Script [ “SplitThemes”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $p; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                    • Else If [ $name = "ScriptCatalog" ]
                                                                    • Set Variable [ $p; Value:MBS( "Path.AddPathComponent"; $Folder; "Scripts") ]
                                                                    • Perform Script [ “SplitScripts”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $p; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                    • Else If [ $name = "BaseTableCatalog" ]
                                                                    • Set Variable [ $p; Value:MBS( "Path.AddPathComponent"; $Folder; "Tables") ]
                                                                    • Perform Script [ “SplitBasetables”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $p; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                    • End If
                                                                    • #next
                                                                    • Set Variable [ $index; Value:$index + 1 ]
                                                                    • Exit Loop If [ $index > $count ]
                                                                    • End Loop
                                                                    • End If
                                                                    • End If
                                                                    • #show XML
                                                                    • Set Field [ SplitXML::XML; $XML ]
                                                                    • Exit Script [ Result: "OK" ]
                                                                    Fields used in this script
                                                                    Scripts used in this script
                                                                    Layouts used in this script
                                                                      Tables used in this script
                                                                      Table occurrences used by this script
                                                                      Custom Functions used by this script
                                                                        Custom menu set used by this script

                                                                          Previous Script: [Split]Next Script: [SplitScripts]
                                                                          Script NameSplitLayouts
                                                                          Run script with full access privilegesOff
                                                                          Include In MenuYes
                                                                          Layouts that use this script
                                                                            Scripts that use this script
                                                                            Script Definition
                                                                            Script Steps
                                                                            • Set Variable [ $Param; Value:Get(ScriptParameter) ]
                                                                            • Set Variable [ $xml; Value:JSONGetElement ( $param ; "xml" ) ]
                                                                            • Set Variable [ $path; Value:JSONGetElement ( $param ; "path" ) ]
                                                                            • #look for groups and create folders
                                                                            • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "Group") ]
                                                                            • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                            • Set Variable [ $index; Value:0 ]
                                                                            • If [ $index < $count ]
                                                                            • Loop
                                                                            • #your script steps here
                                                                            • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "Group"; 0; $index) ]
                                                                            • If [ MBS("IsError") = 0 ]
                                                                            • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "Group#name") ]
                                                                            • Set Variable [ $newPath; Value:MBS( "Path.AddPathComponent"; $path; $name) ]
                                                                            • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $newPath) ]
                                                                            • #sub items?
                                                                            • Perform Script [ “SplitLayouts”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $newPath; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                            • End If
                                                                            • #next
                                                                            • Set Variable [ $index; Value:$index + 1 ]
                                                                            • Exit Loop If [ $index >= $count ]
                                                                            • End Loop
                                                                            • End If
                                                                            • End If
                                                                            • #Write XML for each layout
                                                                            • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "Layout") ]
                                                                            • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                            • Set Variable [ $index; Value:0 ]
                                                                            • If [ $index < $count ]
                                                                            • Loop
                                                                            • #your script steps here
                                                                            • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "Layout"; 0; $index) ]
                                                                            • If [ MBS("IsError") = 0 ]
                                                                            • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "Layout#name") ]
                                                                            • If [ MBS("IsError") = 0 ]
                                                                            • If [ $name ≠ "-" ]
                                                                            • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                            • #Write XML
                                                                            • Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".xml") ]
                                                                            • Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; $x; $filePath; "UTF-8") ]
                                                                            • #Optionally write text
                                                                            • // Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".txt") ]
                                                                            • // Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; MBS( "XML.ExtractText"; $x ); $filePath; "UTF-8") ]
                                                                            • End If
                                                                            • End If
                                                                            • End If
                                                                            • #next
                                                                            • Set Variable [ $index; Value:$index + 1 ]
                                                                            • Exit Loop If [ $index >= $count ]
                                                                            • End Loop
                                                                            • End If
                                                                            • End If
                                                                            Fields used in this script
                                                                              Scripts used in this script
                                                                              Layouts used in this script
                                                                                Tables used in this script
                                                                                  Table occurrences used by this script
                                                                                    Custom Functions used by this script
                                                                                      Custom menu set used by this script

                                                                                        Previous Script: [SplitLayouts]Next Script: [SplitThemes]
                                                                                        Script NameSplitScripts
                                                                                        Run script with full access privilegesOff
                                                                                        Include In MenuYes
                                                                                        Layouts that use this script
                                                                                          Scripts that use this script
                                                                                          Script Definition
                                                                                          Script Steps
                                                                                          • Set Variable [ $Param; Value:Get(ScriptParameter) ]
                                                                                          • Set Variable [ $xml; Value:JSONGetElement ( $param ; "xml" ) ]
                                                                                          • Set Variable [ $path; Value:JSONGetElement ( $param ; "path" ) ]
                                                                                          • #look for groups and create folders
                                                                                          • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "Group") ]
                                                                                          • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                                          • Set Variable [ $index; Value:0 ]
                                                                                          • If [ $index < $count ]
                                                                                          • Loop
                                                                                          • #your script steps here
                                                                                          • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "Group"; 0; $index) ]
                                                                                          • If [ MBS("IsError") = 0 ]
                                                                                          • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "Group#name") ]
                                                                                          • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                                          • Set Variable [ $newPath; Value:MBS( "Path.AddPathComponent"; $path; $name) ]
                                                                                          • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $newPath) ]
                                                                                          • #sub items?
                                                                                          • Perform Script [ “SplitScripts”; Parameter: JSONSetElement ( JSONSetElement ( "{}" ; "path" ; $newPath; JSONString ) ; "xml" ; $x; JSONString ) ]
                                                                                          • End If
                                                                                          • #next
                                                                                          • Set Variable [ $index; Value:$index + 1 ]
                                                                                          • Exit Loop If [ $index >= $count ]
                                                                                          • End Loop
                                                                                          • End If
                                                                                          • End If
                                                                                          • #Write XML for each script
                                                                                          • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "Script") ]
                                                                                          • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                                          • Set Variable [ $index; Value:0 ]
                                                                                          • If [ $index < $count ]
                                                                                          • Loop
                                                                                          • #your script steps here
                                                                                          • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "Script"; 0; $index) ]
                                                                                          • If [ MBS("IsError") = 0 ]
                                                                                          • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "Script#name") ]
                                                                                          • If [ $name ≠ "-" ]
                                                                                          • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                                          • #Write XML
                                                                                          • Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".xml") ]
                                                                                          • Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; $x; $filePath; "UTF-8") ]
                                                                                          • #Optionally write text
                                                                                          • // Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".txt") ]
                                                                                          • // Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; MBS( "XML.ExtractText"; $x ); $filePath; "UTF-8") ]
                                                                                          • End If
                                                                                          • End If
                                                                                          • #next
                                                                                          • Set Variable [ $index; Value:$index + 1 ]
                                                                                          • Exit Loop If [ $index >= $count ]
                                                                                          • End Loop
                                                                                          • End If
                                                                                          • End If
                                                                                          Fields used in this script
                                                                                            Scripts used in this script
                                                                                            Layouts used in this script
                                                                                              Tables used in this script
                                                                                                Table occurrences used by this script
                                                                                                  Custom Functions used by this script
                                                                                                    Custom menu set used by this script

                                                                                                      Previous Script: [SplitScripts]Next Script: [SplitBasetables]
                                                                                                      Script NameSplitThemes
                                                                                                      Run script with full access privilegesOff
                                                                                                      Include In MenuYes
                                                                                                      Layouts that use this script
                                                                                                        Scripts that use this script
                                                                                                        Script Definition
                                                                                                        Script Steps
                                                                                                        • Set Variable [ $Param; Value:Get(ScriptParameter) ]
                                                                                                        • Set Variable [ $xml; Value:JSONGetElement ( $param ; "xml" ) ]
                                                                                                        • Set Variable [ $path; Value:JSONGetElement ( $param ; "path" ) ]
                                                                                                        • #Write XML for each theme
                                                                                                        • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "Theme") ]
                                                                                                        • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                                                        • Set Variable [ $index; Value:0 ]
                                                                                                        • If [ $index < $count ]
                                                                                                        • Loop
                                                                                                        • #your script steps here
                                                                                                        • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "Theme"; 0; $index) ]
                                                                                                        • If [ MBS("IsError") = 0 ]
                                                                                                        • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "Theme#name") ]
                                                                                                        • If [ $name ≠ "-" ]
                                                                                                        • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                                                        • #Write XML
                                                                                                        • Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".xml") ]
                                                                                                        • Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; $x; $filePath; "UTF-8") ]
                                                                                                        • #Optionally write text
                                                                                                        • // Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".txt") ]
                                                                                                        • // Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; MBS( "XML.ExtractText"; $x ); $filePath; "UTF-8") ]
                                                                                                        • End If
                                                                                                        • End If
                                                                                                        • #next
                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                        • Exit Loop If [ $index >= $count ]
                                                                                                        • End Loop
                                                                                                        • End If
                                                                                                        • End If
                                                                                                        Fields used in this script
                                                                                                          Scripts used in this script
                                                                                                            Layouts used in this script
                                                                                                              Tables used in this script
                                                                                                                Table occurrences used by this script
                                                                                                                  Custom Functions used by this script
                                                                                                                    Custom menu set used by this script

                                                                                                                      Previous Script: [SplitThemes]Next Script: [Clear]
                                                                                                                      Script NameSplitBasetables
                                                                                                                      Run script with full access privilegesOff
                                                                                                                      Include In MenuYes
                                                                                                                      Layouts that use this script
                                                                                                                        Scripts that use this script
                                                                                                                        Script Definition
                                                                                                                        Script Steps
                                                                                                                        • Set Variable [ $Param; Value:Get(ScriptParameter) ]
                                                                                                                        • Set Variable [ $xml; Value:JSONGetElement ( $param ; "xml" ) ]
                                                                                                                        • Set Variable [ $path; Value:JSONGetElement ( $param ; "path" ) ]
                                                                                                                        • #Write XML for each theme
                                                                                                                        • Set Variable [ $count; Value:MBS( "XML.NodeCount"; $XML; "BaseTable") ]
                                                                                                                        • If [ MBS("IsError") = 0 and $count > 0 ]
                                                                                                                        • Set Variable [ $index; Value:0 ]
                                                                                                                        • If [ $index < $count ]
                                                                                                                        • Loop
                                                                                                                        • #your script steps here
                                                                                                                        • Set Variable [ $x; Value:MBS("XML.Subtree"; $xml; "BaseTable"; 0; $index) ]
                                                                                                                        • If [ MBS("IsError") = 0 ]
                                                                                                                        • Set Variable [ $name; Value:MBS("XML.GetPathValue"; $x; "BaseTable#name") ]
                                                                                                                        • If [ $name ≠ "-" ]
                                                                                                                        • Set Variable [ $r; Value:MBS( "Files.CreateDirectory"; $path) ]
                                                                                                                        • #Write XML
                                                                                                                        • Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".xml") ]
                                                                                                                        • Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; $x; $filePath; "UTF-8") ]
                                                                                                                        • #Optionally write text
                                                                                                                        • // Set Variable [ $filePath; Value:MBS( "Path.AddPathComponent"; $path; $name & ".txt") ]
                                                                                                                        • // Set Variable [ $r; Value:MBS( "Text.WriteTextFile"; MBS( "XML.ExtractText"; $x ); $filePath; "UTF-8") ]
                                                                                                                        • End If
                                                                                                                        • End If
                                                                                                                        • #next
                                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                        • Exit Loop If [ $index >= $count ]
                                                                                                                        • End Loop
                                                                                                                        • End If
                                                                                                                        • End If
                                                                                                                        Fields used in this script
                                                                                                                          Scripts used in this script
                                                                                                                            Layouts used in this script
                                                                                                                              Tables used in this script
                                                                                                                                Table occurrences used by this script
                                                                                                                                  Custom Functions used by this script
                                                                                                                                    Custom menu set used by this script

                                                                                                                                      Previous Script: [SplitBasetables]
                                                                                                                                      Script NameClear
                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                      Include In MenuYes
                                                                                                                                      Layouts that use this script
                                                                                                                                        Scripts that use this script
                                                                                                                                          Script Definition
                                                                                                                                          Script Steps
                                                                                                                                          • Set Field [ SplitXML::XML; "" ]
                                                                                                                                          Fields used in this script
                                                                                                                                          Scripts used in this script
                                                                                                                                            Layouts used in this script
                                                                                                                                              Tables used in this script
                                                                                                                                              Table occurrences used by this script
                                                                                                                                              Custom Functions used by this script
                                                                                                                                                Custom menu set used by this script

                                                                                                                                                  Download example: Split DDR

                                                                                                                                                  Used functions: