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

MBS FileMaker Plugin Example Databases

Tables

All examples are included with download of MBS FileMaker Plugin.

Tables.fmp12

Overview
Tables2
Relationships0
Layouts2
Scripts5
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
Tables
1 field defined, 1 record
Tables
Images
1 field defined, 17 records
Images

Fields

Table Name: Tables - 1 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
OutputPDFNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1

      Table Name: Images - 1 Fields
      Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
      ImageNormal, BinaryAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1

          Layout Objects: Tables

          Regular Fields

          Field Name: Tables::OutputPDF
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 24 pt
          • Left: 138 pt
          • Bottom: 521 pt
          • Right: 553 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
          No

          Group Buttons

          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Create Text Table
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 24 pt
          • Left: 576 pt
          • Bottom: 49 pt
          • Right: 739 pt
          • Anchoring: Left, Top
          Perform Script [ “CreateTextTable” ]

          Scripts:


          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Create Image Table
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 54 pt
          • Left: 576 pt
          • Bottom: 79 pt
          • Right: 739 pt
          • Anchoring: Left, Top
          Perform Script [ “CreateImageTable” ]

          Scripts:


          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Create Template Table
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 84 pt
          • Left: 576 pt
          • Bottom: 109 pt
          • Right: 739 pt
          • Anchoring: Left, Top
          Perform Script [ “CreateTemplateTable” ]

          Scripts:


          Button PropertiesCoordinatesScript/Script Step
            Type:
          • Text: Create Calendar Table
            Additional Properties:
          • Change to hand cursor over button
          • Rectangular
          • Top: 114 pt
          • Left: 576 pt
          • Bottom: 139 pt
          • Right: 739 pt
          • Anchoring: Left, Top
          Perform Script [ “CreateCalendarTable” ]

          Scripts:


          Layout Objects: Images

          Regular Fields

          Field Name: Images::Image
          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
          • Top: 24 pt
          • Left: 138 pt
          • Bottom: 251 pt
          • Right: 547 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
          No

          Script Hierarchy

          CreateTextTable
          CreateImageTable
          CreateTemplateTable
          CreateCalendarTable
          InitDynaPDF

          Next Script: [CreateImageTable]
          Script NameCreateTextTable
          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: [CreateTextTable]Next Script: [CreateTemplateTable]
                  Script NameCreateImageTable
                  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: [CreateImageTable]Next Script: [CreateCalendarTable]
                        Script NameCreateTemplateTable
                        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
                          • #Find dynapdf_help.pdf
                          • 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" ]
                          • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf_help.pdf" ) ]
                          • #Clear current PDF document
                          • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.OpenPDFFromFile"; $pdf; $path) ]
                          • Set Variable [ $pageCount; Value:MBS("DynaPDF.GetImportPageCount"; $pdf) ]
                          • Set Variable [ $pageCount; Value:20 ]
                          • If [ GetAsNumber($pageCount)>0 ]
                          • #Create Table
                          • Set Variable [ $table; Value:MBS("DynaPDF.Table.Create"; $pdf; $pageCount/4+1; 2; 512,12; 0) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetBorderWidth"; $table; -1; -1; 1; 1; 1; 1) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellPadding"; $table; -1; -1; 5; 5; 5; 5) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetGridWidth"; $table; 1; 1) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetFlags"; $table; -1; -1; "ScaleToRect") ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.SetPageFormat"; $table; "US Letter") ]
                          • #Add Rows
                          • Set Variable [ $rowCount; Value:0 ]
                          • Set Variable [ $i; Value:1 ]
                          • Set Variable [ $x; Value:0 ]
                          • Loop
                          • Set Variable [ $tmpl; Value:MBS("DynaPDF.ImportPageAsTemplate"; $pdf; $i) ]
                          • If [ $x = 0 ]
                          • Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table; 335) ]
                          • End If
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellTemplate"; $table; $rowNum; $x; 1; "center"; "center"; $tmpl; 0; 0) ]
                          • Set Variable [ $x; Value:If($x = 0; 1; 0) ]
                          • Set Variable [ $i; Value:$i + 1 ]
                          • Exit Loop If [ $i > $pageCount ]
                          • End Loop
                          • #Draw Table
                          • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ]
                          • If [ MBS("DynaPDF.Table.HaveMore"; $pdf) ]
                          • Loop
                          • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ]
                          • Exit Loop If [ MBS("DynaPDF.Table.HaveMore"; $pdf) ≠ 1 ]
                          • End Loop
                          • End If
                          • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                          • End If
                          • #Cleanup
                          • Set Field [ Tables::OutputPDF; MBS("DynaPDF.Save"; $pdf) ]
                          • Set Variable [ $r; Value:MBS("DynaPDF.Table.Release"; $table) ]
                          • 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: [CreateTemplateTable]Next Script: [InitDynaPDF]
                                Script NameCreateCalendarTable
                                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
                                  • #Clear current PDF document
                                  • Set Variable [ $pdf; Value:MBS("DynaPDF.New") ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") ]
                                  • Set Variable [ $i; Value:0 ]
                                  • Set Variable [ $pageCount; Value:0 ]
                                  • Set Variable [ $RowCount; Value:0 ]
                                  • #Create Table
                                  • Set Variable [ $table; Value:MBS("DynaPDF.Table.Create"; $pdf; 32; 13; 500; 9) ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetBorderWidth"; $table; -1; -1; 1; 1; 1; 1) ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetGridWidth"; $table; 1; 1) ]
                                  • #Add Rows
                                  • Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.AddRow"; $table) ]
                                  • Set Variable [ $rowNum; Value:MBS("DynaPDF.Table.SetFlags"; $table; 0; -1; "HeaderRow") ]
                                  • Set Variable [ $months; Value:"Jan¶Feb¶Mar¶Apr¶May¶Jun¶Jul¶Aug¶Sep¶Oct¶Nov¶Dec" ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "center"; "center"; "Day") ]
                                  • Set Variable [ $r; Value:MBS("FM.Loop"; /* variable */ "index"; /* start */ 1; /* end */ 12; /* step */ 1; /* formula */ "MBS(\"DynaPDF.Table.SetCellText\"; $table; $rowNum; index; \"center\"; \"center\"; GetValue($months; index))") ]
                                  • #Add Rows
                                  • Set Variable [ $r; Value:MBS("FM.Loop"; /* variable */ "index"; /* start */ 1; /* end */ 31; /* step */ 1; /* formula */ "Let([$rowNum = MBS(\"DynaPDF.Table.AddRow\"; $table); r = MBS(\"DynaPDF.Table.SetCellText\"; $table; $rowNum; 0; \"center\"; \"center\"; index)]; r)") ]
                                  • Set Variable [ $text; Value:"The cell alignment can be set for text, images, and templates..." ]
                                  • #Draw Table
                                  • Set Variable [ $r; Value:MBS("DynaPDF.AppendPage"; $pdf) ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.EndPage"; $pdf) ]
                                  • #Cleanup
                                  • Set Field [ Tables::OutputPDF; MBS("DynaPDF.Save"; $pdf) ]
                                  • Set Variable [ $r; Value:MBS("DynaPDF.Table.Release"; $table) ]
                                  • 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: [CreateCalendarTable]
                                        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
                                          • #you can have libraries in container and export at runtime to folder of your choice.
                                          • #Or install library somewhere and pass path.
                                          • #If library is in same folder as plugin, you can only pass only file name.
                                          • If [ MBS("IsServer") ]
                                          • #Put the path you use for your server here:
                                          • If [ Get(SystemPlatform) = -2 ]
                                          • #Server on Windows
                                          • Set Variable [ $path; Value:"C:\Programs\FileMaker Server\dynapdf.dll" ]
                                          • Else If [ MBS("IsLinux") ]
                                          • #Server on Linux for FileMaker Cloud
                                          • Set Variable [ $path; Value:"/opt/FileMaker/FileMaker Server/dynapdf.linux.so" ]
                                          • Else
                                          • #Server on Mac
                                          • Set Variable [ $path; Value: "/Library/FileMaker Server/dynapdf.dylib" ]
                                          • End If
                                          • Else
                                          • #For desktop and our examples we look in same folder as database:
                                          • 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 [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dll" ) ]
                                          • #plugin will look for dynapdf.dll and if not found also for dynapdf.dll (64-bit) and dynapdf32.dll (32-bit).
                                          • Else
                                          • Set Variable [ $path; Value:Substitute ( $databasePath ; $databaseName ; "dynapdf.dylib" ) ]
                                          • #Mac dylib is usually 32 and 64 bit together.
                                          • End If
                                          • End If
                                          • #You can test for free.
                                          • #If you like to get a dynapdf license, please follow links on our pricing page:
                                          • #https://www.monkeybreadsoftware.de/filemaker/pricing.shtml
                                          • Set Variable [ $LicenseKey; Value:"" // put your key here or leave empty for demo. // Use e.g. "Lite", "Pro" or "Starter" to use demo mode for just that mode. ]
                                          • Set Variable [ $r; Value:MBS( "DynaPDF.Initialize"; $path; $LicenseKey) ]
                                          • If [ $r ≠ "OK" ]
                                          • Show Custom Dialog [ Title: "Error"; Message: $r; Default Button: “OK”, Commit: “No”; Button 2: “Cancel”, Commit: “No” ]
                                          • Halt Script
                                          • 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: Tables

                                                        Used functions: