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

MBS FileMaker Plugin Example Databases

JSON Import

All examples are included with download of MBS FileMaker Plugin.

JSON Import.fmp12

Overview
Tables1
Relationships0
Layouts2
Scripts4
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
JSON Import
1 field defined, 1 record
JSON Import

Fields

Table Name: JSON Import - 1 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
JSONNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German

      Layout Objects: JSON Import

      Regular Fields

      Field Name: JSON Import::JSON
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 66 pt
      • Left: 418 pt
      • Bottom: 318 pt
      • Right: 1001 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

      Buttons

      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: Import
      • Top: 196 pt
      • Left: 49 pt
      • Bottom: 231 pt
      • Right: 249 pt
      • Anchoring: Left, Top
      Perform Script [ “Import” ]

      Scripts:


      Button PropertiesCoordinatesScript/Script Step
        Type:
      • Text: Database Design
      • Top: 243 pt
      • Left: 49 pt
      • Bottom: 278 pt
      • Right: 249 pt
      • Anchoring: Left, Top
      Open Manage Database

      Layout Objects: Test

      Regular Fields

      Field Name: <Missing Field>
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 61 pt
      • Left: 140 pt
      • Bottom: 82 pt
      • Right: 393 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

      Field Name: <Missing Field>
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 84 pt
      • Left: 140 pt
      • Bottom: 105 pt
      • Right: 381 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

      Field Name: <Missing Field>
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 107 pt
      • Left: 140 pt
      • Bottom: 128 pt
      • Right: 393 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

      Field Name: <Missing Field>
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 130 pt
      • Left: 140 pt
      • Bottom: 151 pt
      • Right: 393 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

      Field Name: <Missing Field>
      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
      • Top: 153 pt
      • Left: 140 pt
      • Bottom: 174 pt
      • Right: 393 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

      Import
      Import as PSoS
      Import on Server
      Format JSON

      Next Script: [Import as PSoS]
      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
        • #Make sure we are on the right layout
        • If [ Get(LayoutName) ≠ "JSON Import" ]
        • Go to Layout [ “JSON Import” ]
        • Go to Record/Request/Page [ First ]
        • End If
        • #save in case you just changed it
        • Commit Records/Requests [ No dialog ]
        • #setup progress bar
        • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "") ]
        • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Import JSON") ]
        • 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 JSON from file
        • Set Variable [ $text; Value:JSON Import::JSON ]
        • Set Variable [ $TablePrefix; Value:"Import" ]
        • Set Variable [ $JSONRootName; Value:"" ]
        • Set Variable [ $Flags; Value:0 ]
        • Set Variable [ $r; Value:MBS("JSON.Import"; $text; ""; $TablePrefix; $JSONRootName; $Flags) ]
        • Set Variable [ $text; Value:"" ]
        • #Now loop until complete
        • If [ MBS("IsError") = 0 ]
        • Set Variable [ $total; Value:MBS("JSON.Import.Total") ]
        • Loop
        • Set Variable [ $todo; Value:MBS("JSON.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) ]
        • Pause/Resume Script [ Duration (seconds): 1 ]
        • Set Variable [ $s; Value:MBS("JSON.Import.Status") ]
        • Exit Loop If [ $s ≠ "Working" ]
        • If [ MBS("ProgressDialog.GetCancel") = 1 ]
        • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
        • Set Variable [ $r; Value:MBS("JSON.Import.Cancel") ]
        • Exit Script [ ]
        • End If
        • End Loop
        • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
        • Show Custom Dialog [ Title: "JSON 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

              Previous Script: [Import]Next Script: [Import on Server]
              Script NameImport as PSoS
              Run script with full access privilegesOff
              Include In MenuNo
              Layouts that use this script
                Scripts that use this script
                Script Definition
                Script Steps
                • #This is a version, you could run on a server
                • #Please run once in FMP to create fields
                • Go to Layout [ “JSON Import” ]
                • Go to Record/Request/Page [ First ]
                • Set Variable [ $text; Value:JSON Import::JSON ]
                • Set Variable [ $r; Value:MBS("JSON.Import"; $text; ""; "Import") ]
                • #Now loop until complete
                • If [ MBS("IsError") = 0 ]
                • Set Variable [ $total; Value:MBS("JSON.Import.Total") ]
                • Loop
                • #do some work now
                • Set Variable [ $r; Value:MBS("JSON.Import.Work") ]
                • #let server do indexing
                • Pause/Resume Script [ Duration (seconds): ,1 ]
                • #and check if we are done
                • Set Variable [ $todo; Value:MBS("JSON.Import.Todo") ]
                • Set Variable [ $s; Value:MBS("JSON.Import.Status") ]
                • Exit Loop If [ $s ≠ "Working" ]
                • End Loop
                • Exit Script [ Result: $r & " " & $s ]
                • 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: [Import as PSoS]Next Script: [Format JSON]
                      Script NameImport on Server
                      Run script with full access privilegesOff
                      Include In MenuYes
                      Layouts that use this script
                        Scripts that use this script
                          Script Definition
                          Script Steps
                          • Perform Script on Server [ “Import as PSoS” ] [ Wait for completion ]
                          • Show Custom Dialog [ Title: "Script Result"; Message: Get(ScriptResult); Default Button: “OK”, Commit: “Yes” ]
                          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: [Import on Server]
                                      Script NameFormat JSON
                                      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 [ $json; Value:MBS("JSON.Format"; JSON Import::JSON) ]
                                          • If [ MBS("IsError") = 0 ]
                                          • Set Variable [ $json; Value:MBS("JSON.Colorize"; $json) ]
                                          • If [ MBS("IsError") = 0 ]
                                          • Set Field [ JSON Import::JSON; $json ]
                                          • 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

                                                  Download example: JSON Import

                                                  Used functions: