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

MBS FileMaker Plugin Example Databases

XML Import

All examples are included with download of MBS FileMaker Plugin.

XML Import.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts1
Value Lists0
Custom Functions0
Custom Menus24
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
XML Import
0 fields defined, 0 record
XML Import

Layout Objects: XML Import

Script Hierarchy

Import

Script NameImport
Run script with full access privilegesOff
Include In MenuYes
Layouts that use this script
    Scripts that use this script
      Script Definition
      Script Steps
      • Go to Layout [ “XML Import” ]
      • Delete All Records [ No dialog ]
      • #setup progress bar
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "") ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Import XML") ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Import...") ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
      • Pause/Resume Script [ Duration (seconds): ,1 ]
      • #read XML from file
      • Set Variable [ $folder; Value:MBS( "Folders.UserDesktop" ) ]
      • Set Variable [ $file; Value:MBS( "Path.AddPathComponent"; $folder; "test.xml" ) ]
      • Set Variable [ $text; Value:MBS("Text.ReadTextFile"; $file; "UTF-8") ]
      • If [ Length ( $text ) < 1 ]
      • Show Custom Dialog [ Title: "XML Import"; Message: "No data?"; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
      • Exit Script [ Result: "No data?" ]
      • End If
      • // Set Variable [ $text; Value:Substitute($text; "<?xml version=\"1.0\" encoding=\"WINDOWS-1252\"?>"; "") ]
      • #read XML from file
      • Set Variable [ $TablePrefix; Value:"Import" ]
      • Set Variable [ $Flags; Value:0 ]
      • Set Variable [ $r; Value:MBS("XML.Import"; $text; ""; $TablePrefix; $Flags) ]
      • Set Variable [ $text; Value:"" ]
      • #Now loop until complete
      • If [ MBS("IsError") = 0 ]
      • Set Variable [ $total; Value:MBS("XML.Import.Total") ]
      • Loop
      • Set Variable [ $todo; Value:MBS("XML.Import.Todo") ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; ($total - $todo) * 100 / $total) ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "Step " & ($total - $todo) & " of " & $total) ]
      • If [ MBS("IsServer") ]
      • #import at server in a work call
      • Set Variable [ $todo; Value:MBS("XML.Import.Work") ]
      • Else
      • #import at client in a pause
      • Pause/Resume Script [ Duration (seconds): 1 ]
      • End If
      • Set Variable [ $s; Value:MBS("XML.Import.Status") ]
      • Exit Loop If [ $s ≠ "Working" ]
      • If [ MBS("ProgressDialog.GetCancel") = 1 ]
      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
      • Set Variable [ $r; Value:MBS("XML.Import.Cancel") ]
      • Exit Script [ ]
      • End If
      • End Loop
      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
      • Show Custom Dialog [ Title: "XML Import"; Message: $r & " " & $s; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
      • End If
      • #Cleanup prorgress bar
      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
      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: XML Import

                  Used functions: