MBS FileMaker Plugin Example Databases

Form

All examples are included with download of MBS FileMaker Plugin.

Form.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts5
Value Lists0
Custom Functions1
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
Form
7 fields defined, 3 records
Form

Fields

Table Name: Form - 7 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
FirstnameNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      LastnameNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          AddressNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              CityNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  CountryNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      EmailNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                          IDNormal, TextAuto-Enter:
                          • Context table: Form
                            Calculation: Get ( UUID )
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: All
                          • Index Language: German

                              Layout Objects: Form

                              Regular Fields

                              Field Name: Form::Firstname
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 52 pt
                              • Left: 138 pt
                              • Bottom: 73 pt
                              • Right: 504 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: Form::Lastname
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 75 pt
                              • Left: 138 pt
                              • Bottom: 96 pt
                              • Right: 504 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: Form::Address
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 98 pt
                              • Left: 138 pt
                              • Bottom: 119 pt
                              • Right: 504 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: Form::City
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 121 pt
                              • Left: 138 pt
                              • Bottom: 142 pt
                              • Right: 504 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: Form::Country
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 144 pt
                              • Left: 138 pt
                              • Bottom: 165 pt
                              • Right: 504 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: Form::Email
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 167 pt
                              • Left: 138 pt
                              • Bottom: 188 pt
                              • Right: 504 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: Form::ID
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 190 pt
                              • Left: 138 pt
                              • Bottom: 211 pt
                              • Right: 504 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: Create Template
                              • Top: 8 pt
                              • Left: 15 pt
                              • Bottom: 41 pt
                              • Right: 180 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Create Template PDF” ]

                              Scripts:


                              Button PropertiesCoordinatesScript/Script Step
                                Type:
                              • Text: Export this record
                              • Top: 9 pt
                              • Left: 197 pt
                              • Bottom: 42 pt
                              • Right: 362 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Export PDF” ]

                              Scripts:


                              Button PropertiesCoordinatesScript/Script Step
                                Type:
                              • Text: Import new PDF
                              • Top: 9 pt
                              • Left: 379 pt
                              • Bottom: 42 pt
                              • Right: 544 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Import PDF” ]

                              Scripts:


                              Button PropertiesCoordinatesScript/Script Step
                                Type:
                              • Text: Import changes from PDF
                              • Top: 9 pt
                              • Left: 561 pt
                              • Bottom: 42 pt
                              • Right: 726 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Update from PDF” ]

                              Scripts:


                              Script Hierarchy

                              InitDynaPDF
                              Create Template PDF
                              Export PDF
                              Import PDF
                              Update from PDF

                              Next Script: [Create Template PDF]
                              Script NameInitDynaPDF
                              Run script with full access privilegesOff
                              Include In MenuNo
                              Layouts that use this script
                                Scripts that use this script
                                Script Definition
                                Script Steps
                                • #Locate DynaPDF library
                                • Set Variable [ $databasePath; Value:Get(FilePath) ]
                                • Set Variable [ $databasePath; Value:MBS("Path.FilemakerPathToNativePath"; $databasePath) ]
                                • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; ".fp7" ; ".fmp12") ]
                                • Set Variable [ $databaseName; Value:Get(FileName) & ".fmp12" ]
                                • If [ Get(SystemPlatform) = -2 ]
                                • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; "\Form\\"; "\\" ) ]
                                • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                                • Else
                                • Set Variable [ $databasePath; Value:Substitute ( $databasePath ; "/Form/"; "/" ) ]
                                • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                                • End If
                                • #Initialize DynaPDF
                                • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path) ]
                                • Set Variable [ $$DynaPDFInited; Value:1 ]
                                • If [ $r ≠ "OK" ]
                                • Show Custom Dialog [ Title: "DynaPDF failed to initialize"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, 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: [InitDynaPDF]Next Script: [Export PDF]
                                              Script NameCreate Template PDF
                                              Run script with full access privilegesOff
                                              Include In MenuYes
                                              Layouts that use this script
                                              Scripts that use this script
                                                Script Definition
                                                Script Steps
                                                • #Initialize DynaPDF if needed
                                                • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                • Perform Script [ “InitDynaPDF” ]
                                                • End If
                                                • #Import form.pdf and add fields
                                                • Set Variable [ $FormPath; Value:MBS( "Path.FileMakerPathToNativePath"; Substitute ( Get ( FilePath ); ".fmp12"; ".pdf")) ]
                                                • Set Variable [ $TemplatePath; Value:Substitute ( $FormPath; "Form.pdf"; "Template.pdf") ]
                                                • #Clear current PDF document
                                                • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                • #Load PDF from file
                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromFile"; $pdf; $FormPath) ]
                                                • If [ MBS("IsError") ]
                                                • Show Custom Dialog [ Title: "Failed"; Message: "Failed to read PDF file." & ¶ & $r; Default Button: “OK”, Commit: “Yes” ]
                                                • Else
                                                • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf) ]
                                                • Set Variable [ $r; Value:MBS("DynaPDF.EditPage"; $pdf; 1) ]
                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetFieldBackColor"; $pdf; MBS("DynaPDF.RGB"; 200; 200; 200)) ]
                                                • Set Variable [ $r; Value:MBS("DynaPDF.SetFieldBorderColor"; $pdf; 0 /* black */) ]
                                                • #We position fields where we find label text
                                                • // Set Variable [ $r; Value:Let ( [ fieldName = "Firstname"; findText = "Firstname:"; found = MBS( "DynaPDF.FindText"; $pdf; fieldName; 0 ); posText1 = MiddleWords ( found ; 2 ; 1 ); posNum1 = MBS( "Math.TextToNumber"; posText1 ); posText2 = MiddleWords ( found ; 6 ; 1 ); posNum2 = MBS( "Math.TextToNumber"; posText2 ); field = MBS( "DynaPDF.CreateTextField"; $pdf; fieldName; -1; 0; 200; 120; posNum1-3; 300; posNum2-posNum1+5 ); r = MBS("DynaPDF.SetFieldBorderStyle"; $pdf; field; "Bevelled") ]; field ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "Firstname" ; "Firstname:" ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "Lastname" ; "Lastname:" ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "Address" ; "Address:" ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "City" ; "City:" ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "Country" ; "Country:" ) ]
                                                • Set Variable [ $r; Value:CreateTextField ( "Email" ; "Email:" ) ]
                                                • Set Variable [ $r; Value:Let ( [ fieldName = "ID"; field = MBS( "DynaPDF.CreateTextField"; $pdf; fieldName; -1; 0; 200; 120; -50; 300; 20 ); r = MBS("DynaPDF.SetFieldFlags"; $pdf; field; "Hidden ReadOnly Invisible NoView"; 1) /* yes, three ways to hide! */ ]; field ) ]
                                                • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                                • Set Variable [ $r; Value:MBS("DynaPDF.OpenOutputFIle"; $pdf; $templatePath) ]
                                                • If [ MBS("IsError") ]
                                                • Show Custom Dialog [ Title: "Failed"; Message: "Failed to create PDF file." & ¶ & $r; Default Button: “OK”, Commit: “Yes” ]
                                                • End If
                                                • End If
                                                • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                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 Template PDF]Next Script: [Import PDF]
                                                          Script NameExport PDF
                                                          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: [Export PDF]Next Script: [Update from PDF]
                                                                  Script NameImport PDF
                                                                  Run script with full access privilegesOff
                                                                  Include In MenuYes
                                                                  Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • #Initialize DynaPDF if needed
                                                                    • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                    • Perform Script [ “InitDynaPDF” ]
                                                                    • End If
                                                                    • #Ask user for file path
                                                                    • Set Variable [ $r; Value:MBS("FileDialog.Reset") ]
                                                                    • Set Variable [ $r; Value:MBS("FileDialog.SetMessage"; "Please select PDF file") ]
                                                                    • Set Variable [ $r; Value:MBS("FileDialog.OpenFileDialog") ]
                                                                    • If [ $r ≠ "OK" ]
                                                                    • Exit Script [ ]
                                                                    • End If
                                                                    • Set Variable [ $path; Value:MBS("FileDialog.GetPath"; 0) ]
                                                                    • #Clear current PDF document
                                                                    • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                    • #Load PDF from file
                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromFile"; $pdf; $path) ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed"; Message: "Failed to read PDF file." & ¶ & $r; Default Button: “OK”, Commit: “Yes” ]
                                                                    • Else
                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf) ]
                                                                    • #Create new record with values in form
                                                                    • New Record/Request
                                                                    • Set Field [ Form::Firstname; MBS( "DynaPDF.GetField"; $pdf; "Firstname"; "Value" ) ]
                                                                    • Set Field [ Form::Lastname; MBS( "DynaPDF.GetField"; $pdf; "Lastname"; "Value" ) ]
                                                                    • Set Field [ Form::Address; MBS( "DynaPDF.GetField"; $pdf; "Address"; "Value" ) ]
                                                                    • Set Field [ Form::City; MBS( "DynaPDF.GetField"; $pdf; "City"; "Value" ) ]
                                                                    • Set Field [ Form::Country; MBS( "DynaPDF.GetField"; $pdf; "Country"; "Value" ) ]
                                                                    • Set Field [ Form::Email; MBS( "DynaPDF.GetField"; $pdf; "Email"; "Value" ) ]
                                                                    • Commit Records/Requests [ No dialog ]
                                                                    • End If
                                                                    • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                    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 PDF]
                                                                          Script NameUpdate from PDF
                                                                          Run script with full access privilegesOff
                                                                          Include In MenuYes
                                                                          Layouts that use this script
                                                                          Scripts that use this script
                                                                            Script Definition
                                                                            Script Steps
                                                                            • #Initialize DynaPDF if needed
                                                                            • If [ MBS("DynaPDF.IsInitialized") ≠ 1 ]
                                                                            • Perform Script [ “InitDynaPDF” ]
                                                                            • End If
                                                                            • #Ask user for file path
                                                                            • Set Variable [ $r; Value:MBS("FileDialog.Reset") ]
                                                                            • Set Variable [ $r; Value:MBS("FileDialog.SetMessage"; "Please select PDF file") ]
                                                                            • Set Variable [ $r; Value:MBS("FileDialog.OpenFileDialog") ]
                                                                            • If [ $r ≠ "OK" ]
                                                                            • Exit Script [ ]
                                                                            • End If
                                                                            • Set Variable [ $path; Value:MBS("FileDialog.GetPath"; 0) ]
                                                                            • #Clear current PDF document
                                                                            • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                                                            • #Load PDF from file
                                                                            • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromFile"; $pdf; $path) ]
                                                                            • If [ MBS("IsError") ]
                                                                            • Show Custom Dialog [ Title: "Failed"; Message: "Failed to read PDF file." & ¶ & $r; Default Button: “OK”, Commit: “Yes” ]
                                                                            • Else
                                                                            • Set Variable [ $r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf) ]
                                                                            • #Look for record by ID
                                                                            • Set Variable [ $ID; Value:MBS( "DynaPDF.GetField"; $pdf; "ID"; "Value" ) ]
                                                                            • Set Error Capture [ On ]
                                                                            • Perform Find [ Specified Find Requests: Find Records; Criteria: Form::ID: “==$ID” ] [ Restore ]
                                                                            • If [ Get ( FoundCount ) = 1 ]
                                                                            • #Update values
                                                                            • Set Field [ Form::Firstname; MBS( "DynaPDF.GetField"; $pdf; "Firstname"; "Value" ) ]
                                                                            • Set Field [ Form::Lastname; MBS( "DynaPDF.GetField"; $pdf; "Lastname"; "Value" ) ]
                                                                            • Set Field [ Form::Address; MBS( "DynaPDF.GetField"; $pdf; "Address"; "Value" ) ]
                                                                            • Set Field [ Form::City; MBS( "DynaPDF.GetField"; $pdf; "City"; "Value" ) ]
                                                                            • Set Field [ Form::Country; MBS( "DynaPDF.GetField"; $pdf; "Country"; "Value" ) ]
                                                                            • Set Field [ Form::Email; MBS( "DynaPDF.GetField"; $pdf; "Email"; "Value" ) ]
                                                                            • Else
                                                                            • Show Custom Dialog [ Title: "Record not found"; Message: MBS( "DynaPDF.GetField"; $pdf; "Firstname"; "Value" ) & " " & MBS( "DynaPDF.GetField"; $pdf; "Lastname"; "Value" ) & ¶ & $ID; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                            • End If
                                                                            • Show All Records
                                                                            • End If
                                                                            • Set Variable [ $r; Value:MBS("DynaPDF.Release"; $pdf) ]
                                                                            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

                                                                                  Custom Functions

                                                                                  Function NameParametersAvailabilityDefinitionIn Field DefinitionsIn Scripts
                                                                                  CreateTextFieldfieldName;findTextAll accountsLet ( [ found = MBS( "DynaPDF.FindText"; $pdf; fieldName; 0 ); posText1 = MiddleWords ( found ; 2 ; 1 ); posNum1 = MBS( "Math.TextToNumber"; posText1 ); posText2 = MiddleWords ( found ; 6 ; 1 ); posNum2 = MBS( "Math.TextToNumber"; posText2 ); field = MBS( "DynaPDF.CreateTextField"; $pdf; fieldName; -1; 0; 200; 120; posNum1-3; 300; posNum2-posNum1+5 ); r = MBS("DynaPDF.SetFieldBorderStyle"; $pdf; field; "Bevelled") ]; field )

                                                                                    Custom Menu Sets

                                                                                    Menu SetsMenusIn ScriptsIn LayoutsComments
                                                                                    [Standard FileMaker Menus]
                                                                                    • All Standard Menus

                                                                                    Download example: Form

                                                                                    Used functions:




                                                                                    Links
                                                                                    MBS FileMaker Plugins