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

MBS FileMaker Plugin Example Databases

Barcode Generation JSON

All examples are included with download of MBS FileMaker Plugin.

Barcode Generation JSON.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts7
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
Barcode Generation JSON
3 fields defined, 11 records
Barcode Generation JSON

Fields

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

                Layout Objects: Barcode Generation JSON

                Regular Fields

                Field Name: Barcode Generation JSON::Description
                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                • Top: 52 pt
                • Left: 138 pt
                • Bottom: 73 pt
                • Right: 391 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: Barcode Generation JSON::JSON
                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                • Top: 75 pt
                • Left: 138 pt
                • Bottom: 288 pt
                • Right: 508 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: Barcode Generation JSON::Image
                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                • Top: 59 pt
                • Left: 645 pt
                • Bottom: 288 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
                No

                Buttons

                Button PropertiesCoordinatesScript/Script Step
                  Type:
                • Text: Format JSON
                • Top: 75 pt
                • Left: 519 pt
                • Bottom: 107 pt
                • Right: 634 pt
                • Anchoring: Left, Top
                Perform Script [ “Format JSON” ]

                Scripts:


                Button PropertiesCoordinatesScript/Script Step
                  Type:
                • Text: Generate Barcode
                • Top: 128 pt
                • Left: 519 pt
                • Bottom: 160 pt
                • Right: 634 pt
                • Anchoring: Left, Top
                Perform Script [ “Run” ]

                Scripts:


                Script Hierarchy

                Format JSON
                Run
                Clear Images
                -
                Create Barcode
                Create Barcode on Server
                Barcode Test

                Next Script: [Run]
                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"; Barcode Generation JSON::JSON) ]
                  • If [ MBS("IsError") = 0 ]
                  • Set Variable [ $json; Value:MBS("JSON.Colorize"; $json) ]
                  • If [ MBS("IsError") = 0 ]
                  • Set Field [ Barcode Generation JSON::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

                          Previous Script: [Format JSON]Next Script: [Clear Images]
                          Script NameRun
                          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 [ Barcode Generation JSON::Image; "" ]
                            • Set Variable [ $img; Value:MBS("Barcode.GenerateJSON"; Barcode Generation JSON::JSON) ]
                            • If [ MBS("IsError") = 0 ]
                            • Set Field [ Barcode Generation JSON::Image; MBS( "GMImage.WriteToPNGContainer"; $img; "barcode.png") ]
                            • Set Variable [ $r; Value:MBS( "GMImage.Destroy"; $img ) ]
                            • Else
                            • Show Custom Dialog [ Title: "Failed to create barcode"; Message: $img; Default Button: “OK”, Commit: “Yes” ]
                            • 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: [Run]Next Script: [-]
                                    Script NameClear Images
                                    Run script with full access privilegesOff
                                    Include In MenuYes
                                    Layouts that use this script
                                      Scripts that use this script
                                        Script Definition
                                        Script Steps
                                        • Replace Field Contents [ Barcode Generation JSON::Image; Replace with calculation: "" ] [ No dialog ]
                                        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: [Clear Images]Next Script: [Create Barcode]
                                                Script Name-
                                                Run script with full access privilegesOff
                                                Include In MenuYes
                                                Layouts that use this script
                                                  Scripts that use this script
                                                    Script Definition
                                                    Script Steps
                                                      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: [-]Next Script: [Create Barcode on Server]
                                                                    Script NameCreate Barcode
                                                                    Run script with full access privilegesOff
                                                                    Include In MenuNo
                                                                    Layouts that use this script
                                                                      Scripts that use this script
                                                                      Script Definition
                                                                      Script Steps
                                                                      • #This script is run locally in FileMaker Pro or Go to create barcode via server
                                                                      • Set Variable [ $JSON; Value:Get(ScriptParameter) ]
                                                                      • Set Variable [ $result; Value:"" ]
                                                                      • If [ GetAsText(MBS("Version")) = "?" ]
                                                                      • #no MBS Plugin, so pass to server
                                                                      • Perform Script on Server [ “Create Barcode on Server”; Parameter: $JSON ] [ Wait for completion ]
                                                                      • Set Variable [ $errorCode; Value:Get(LastError) ]
                                                                      • If [ $errorCode ≠ 0 ]
                                                                      • #report error back to caller
                                                                      • Set Variable [ $error; Value:"Failed to trigger script on server with error " & $errorCode ]
                                                                      • Set Variable [ $result; Value:JSONSetElement ( $JSON ; "error" ; $error; JSONString ) ]
                                                                      • Else
                                                                      • #pass result back to caller
                                                                      • Set Variable [ $result; Value:Get(ScriptResult) ]
                                                                      • End If
                                                                      • Else
                                                                      • #with MBS Plugin
                                                                      • Perform Script [ “Create Barcode on Server”; Parameter: $JSON ]
                                                                      • Set Variable [ $result; Value:Get(ScriptResult) ]
                                                                      • End If
                                                                      • Exit Script [ Result: $result ]
                                                                      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: [Create Barcode]Next Script: [Barcode Test]
                                                                                  Script NameCreate Barcode on Server
                                                                                  Run script with full access privilegesOff
                                                                                  Include In MenuNo
                                                                                  Layouts that use this script
                                                                                    Scripts that use this script
                                                                                    Script Definition
                                                                                    Script Steps
                                                                                    • #This script is run on server to provide barcode to clients without MBS Plugin
                                                                                    • Set Variable [ $JSON; Value:Get(ScriptParameter) ]
                                                                                    • Set Variable [ $result; Value:"" ]
                                                                                    • If [ GetAsText(MBS("Version")) = "?" ]
                                                                                    • #no MBS Plugin
                                                                                    • Set Variable [ $result; Value:JSONSetElement ( $JSON ; "error" ; "No MBS Plugin on server installed."; JSONString ) ]
                                                                                    • Else
                                                                                    • #with MBS Plugin
                                                                                    • #generate barcode based on JSON
                                                                                    • Set Variable [ $img; Value:MBS("Barcode.GenerateJSON"; $JSON) ]
                                                                                    • If [ MBS("IsError") = 0 ]
                                                                                    • #Create PNG image file as container value
                                                                                    • Set Variable [ $Image; Value:MBS( "GMImage.WriteToPNGContainer"; $img; "barcode.png") ]
                                                                                    • If [ MBS("IsError") = 0 ]
                                                                                    • #Return image base64 encoded
                                                                                    • Set Variable [ $result; Value:JSONSetElement ( $JSON ; "barcode" ; Base64Encode ( $Image ); JSONString ) ]
                                                                                    • Else
                                                                                    • #Pass back error
                                                                                    • Set Variable [ $result; Value:JSONSetElement ( $JSON ; "error" ; $Image; JSONString ) ]
                                                                                    • End If
                                                                                    • #free memory
                                                                                    • Set Variable [ $r; Value:MBS( "GMImage.Destroy"; $img ) ]
                                                                                    • Else
                                                                                    • #Pass back error
                                                                                    • Set Variable [ $result; Value:JSONSetElement ( $JSON ; "error" ; $img; JSONString ) ]
                                                                                    • End If
                                                                                    • End If
                                                                                    • Exit Script [ Result: $result ]
                                                                                    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: [Create Barcode on Server]
                                                                                                  Script NameBarcode Test
                                                                                                  Run script with full access privilegesOff
                                                                                                  Include In MenuYes
                                                                                                  Layouts that use this script
                                                                                                    Scripts that use this script
                                                                                                      Script Definition
                                                                                                      Script Steps
                                                                                                      • #Build JSON to call
                                                                                                      • Set Variable [ $JSON; Value:Barcode Generation JSON::JSON ]
                                                                                                      • // Set Variable [ $JSON; Value:JSONSetElement ( "{}" ; "symbology" ; "QRCode"; JSONString ) ]
                                                                                                      • // Set Variable [ $JSON; Value:JSONSetElement ( $JSON ; "Text" ; "Hello World"; JSONString ) ]
                                                                                                      • // Set Variable [ $JSON; Value:JSONSetElement ( $JSON ; "Scale" ; "4"; JSONNumber ) ]
                                                                                                      • #run script to create barcode
                                                                                                      • Perform Script [ “Create Barcode”; Parameter: $JSON ]
                                                                                                      • Set Variable [ $value; Value:Get(ScriptResult) ]
                                                                                                      • #check result
                                                                                                      • Set Variable [ $barcode; Value:JSONGetElement ( $value ; "barcode" ) ]
                                                                                                      • If [ Length ( $barcode ) > 0 ]
                                                                                                      • Set Field [ Barcode Generation JSON::Image; Base64Decode ( $barcode; "barcode.png" ) ]
                                                                                                      • Else
                                                                                                      • Set Variable [ $error; Value:JSONGetElement ( $value ; "error" ) ]
                                                                                                      • Show Custom Dialog [ Title: "Failed to create barcode"; Message: $error; Default Button: “OK”, Commit: “Yes” ]
                                                                                                      • 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: Barcode Generation JSON

                                                                                                            Used functions: