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

MBS FileMaker Plugin Example Databases

JavaScript

All examples are included with download of MBS FileMaker Plugin.

JavaScript.fmp12

Overview
Tables2
Relationships0
Layouts2
Scripts7
Value Lists0
Custom Functions0
Custom Menus33
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
JavaScript
4 fields defined, 3 records
JavaScript
Hello
3 fields defined, 2 records
Hello

Fields

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

                  Table Name: Hello - 3 Fields
                  Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
                  KeyNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                        ValueNormal, TextAuto-Enter:
                        • Allow editing
                        Validation:
                        • Only during data entry
                        Storage:
                        • Repetitions: 1
                        • Indexing: None
                        • Automatically create indexes as needed
                        • Index Language: German
                              CountNormal, NumberAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Repetitions: 1
                              • Indexing: All
                              • Index Language: German

                                    Layout Objects: JavaScript

                                    Regular Fields

                                    Field Name: JavaScript::Script
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 24 pt
                                    • Left: 138 pt
                                    • Bottom: 104 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Field Name: JavaScript::Name
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 180 pt
                                    • Left: 138 pt
                                    • Bottom: 194 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Field Name: JavaScript::Value
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 198 pt
                                    • Left: 138 pt
                                    • Bottom: 212 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Field Name: JavaScript::Result
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 108 pt
                                    • Left: 138 pt
                                    • Bottom: 122 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Group Buttons

                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Initialize
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 24 pt
                                    • Left: 408 pt
                                    • Bottom: 49 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “Init” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Evaluate Script
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 54 pt
                                    • Left: 408 pt
                                    • Bottom: 79 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “Evaluate” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Has Property?
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 150 pt
                                    • Left: 408 pt
                                    • Bottom: 175 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “HasProperty” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Query Property
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 180 pt
                                    • Left: 408 pt
                                    • Bottom: 205 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “GetProperty” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Set Property
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 210 pt
                                    • Left: 408 pt
                                    • Bottom: 235 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “SetProperty” ]

                                    Scripts:


                                    Button PropertiesCoordinatesScript/Script Step
                                      Type:
                                    • Text: Release
                                      Additional Properties:
                                    • Change to hand cursor over button
                                    • Rectangular
                                    • Top: 84 pt
                                    • Left: 408 pt
                                    • Bottom: 109 pt
                                    • Right: 541 pt
                                    • Anchoring: Left, Top
                                    Perform Script [ “Release” ]

                                    Scripts:


                                    Layout Objects: Hello

                                    Regular Fields

                                    Field Name: Hello::Key
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 24 pt
                                    • Left: 138 pt
                                    • Bottom: 38 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Field Name: Hello::Value
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 42 pt
                                    • Left: 138 pt
                                    • Bottom: 56 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: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Field Name: Hello::Count
                                    Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                    • Top: 60 pt
                                    • Left: 138 pt
                                    • Bottom: 74 pt
                                    • Right: 217 pt
                                    • Anchoring: Left, Top
                                    Field Format:
                                    • Edit Box
                                    Field Behavior:
                                    • Allow field to be entered: In Find mode, In Browse mode
                                    • Touch keyboard type: System Default
                                    • Go to next field using: Tab key
                                    Yes

                                    Script Hierarchy

                                    Init
                                    Release
                                    SetProperty
                                    GetProperty
                                    HasProperty
                                    Evaluate
                                    test

                                    Next Script: [Release]
                                    Script NameInit
                                    Run script with full access privilegesOff
                                    Include In MenuYes
                                    Layouts that use this script
                                    Scripts that use this script
                                      Script Definition
                                      Script Steps
                                      • If [ not (IsEmpty($$Context)) ]
                                      • Set Variable [ $r; Value:MBS("JavaScript.Release"; $$Context) ]
                                      • Set Variable [ $$Context; Value:"" ]
                                      • End If
                                      • Set Variable [ $r; Value:MBS("JavaScript.New") ]
                                      • If [ MBS("IsError") ]
                                      • Show Custom Dialog [ Title: "Failed to initialize"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                      • Else
                                      • Set Variable [ $$Context; Value:$r ]
                                      • Show Custom Dialog [ Message: "OK"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                      • End If
                                      • Set Variable [ $r; Value:MBS( "JavaScript.RegisterFunction"; $$Context; "Test"; "Value¶Count"; "return Value * Count;") ]
                                      • Set Variable [ $r; Value:MBS( "JavaScript.RegisterEvaluateFunction"; $$Context; "FMEvaluate" ) ]
                                      • Set Variable [ $r; Value:MBS( "JavaScript.RegisterRunScriptFunction"; $$Context; "FMRunScript" ) ]
                                      • Set Variable [ $r; Value:MBS( "JavaScript.RegisterSQLQueryFunction"; $$Context; "FMQuery" ) ]
                                      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: [Init]Next Script: [SetProperty]
                                                    Script NameRelease
                                                    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: [Release]Next Script: [GetProperty]
                                                                      Script NameSetProperty
                                                                      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: [SetProperty]Next Script: [HasProperty]
                                                                                Script NameGetProperty
                                                                                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: [GetProperty]Next Script: [Evaluate]
                                                                                          Script NameHasProperty
                                                                                          Run script with full access privilegesOff
                                                                                          Include In MenuYes
                                                                                          Layouts that use this script
                                                                                          Scripts that use this script
                                                                                            Script Definition
                                                                                            Script Steps
                                                                                            • If [ MBS("JavaScript.HasProperty"; $$Context; JavaScript::Name) ]
                                                                                            • Show Custom Dialog [ Message: "property found"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                            • Else
                                                                                            • Show Custom Dialog [ Message: "property not found"; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                            • 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: [HasProperty]Next Script: [test]
                                                                                                    Script NameEvaluate
                                                                                                    Run script with full access privilegesOff
                                                                                                    Include In MenuYes
                                                                                                    Layouts that use this script
                                                                                                    Scripts that use this script
                                                                                                      Script Definition
                                                                                                      Script Steps
                                                                                                      • If [ IsEmpty($$Context) ]
                                                                                                      • Show Custom Dialog [ Message: "Please initialize first."; Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                      • Exit Script [ ]
                                                                                                      • End If
                                                                                                      • Set Variable [ $r; Value:MBS("JavaScript.evaluateScript"; $$Context; JavaScript::Script) ]
                                                                                                      • Set Field [ JavaScript::Result; $r ]
                                                                                                      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: [Evaluate]
                                                                                                              Script Nametest
                                                                                                              Run script with full access privilegesOff
                                                                                                              Include In MenuYes
                                                                                                              Layouts that use this script
                                                                                                                Scripts that use this script
                                                                                                                  Script Definition
                                                                                                                  Script Steps
                                                                                                                  • Show Custom Dialog [ Message: Get(ScriptParameter); Default Button: “OK”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]
                                                                                                                  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

                                                                                                                                Used functions: