MBS FileMaker Plugin Example Databases

MapView Click Polygons

All examples are included with download of MBS FileMaker Plugin.

MapView Click Polygons.fmp12

Overview
Tables2
Relationships1
Layouts2
Scripts10
Value Lists0
Custom Functions0
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
OnFirstWindowOpenScript: Clear
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
MapView
3 fields defined, 7 records
MapView
Points
4 fields defined, 0 record
Points

Fields

Table Name: MapView - 3 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
AddressNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
          MapIDNormal, TextAuto-Enter:
          • Allow editing
          • Do not replace existing value for field (if any)
          • Context table: MapView
            Calculation: Get(UUID)
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: Minimal
          • Automatically create indexes as needed
          • Index Language: German
            ClickedNormal, TextAuto-Enter:
            • Allow editing
            Validation:
            • Only during data entry
            Storage:
            • Repetitions: 1
            • Indexing: None
            • Automatically create indexes as needed
            • Index Language: German

                Table Name: Points - 4 Fields
                Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
                PointIDNormal, TextAuto-Enter:
                • Allow editing
                • Do not replace existing value for field (if any)
                • Context table: Points
                  Calculation: Get(UUID)
                Validation:
                • Only during data entry
                Storage:
                • Repetitions: 1
                • Indexing: Minimal
                • Automatically create indexes as needed
                • Index Language: German
                    LatitudeNormal, NumberAuto-Enter:
                    • Allow editing
                    Validation:
                    • Only during data entry
                    Storage:
                    • Repetitions: 1
                    • Indexing: None
                    • Automatically create indexes as needed
                    • Index Language: German
                        LongitudeNormal, NumberAuto-Enter:
                        • Allow editing
                        Validation:
                        • Only during data entry
                        Storage:
                        • Repetitions: 1
                        • Indexing: None
                        • Automatically create indexes as needed
                        • Index Language: German
                            MapIDNormal, TextAuto-Enter:
                            • Allow editing
                            Validation:
                            • Only during data entry
                            Storage:
                            • Repetitions: 1
                            • Indexing: Minimal
                            • Automatically create indexes as needed
                            • Index Language: German

                              Layout Objects: MapView

                              Regular Fields

                              Field Name: Points::Latitude
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 62 pt
                              • Left: 900 pt
                              • Bottom: 83 pt
                              • Right: 1014 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: Points::Longitude
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 62 pt
                              • Left: 1016 pt
                              • Bottom: 83 pt
                              • Right: 1129 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: MapView::Clicked
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 418 pt
                              • Left: 897 pt
                              • Bottom: 522 pt
                              • Right: 1129 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: MapView::MapID
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 535 pt
                              • Left: 72 pt
                              • Bottom: 556 pt
                              • Right: 325 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 MapView
                              • Top: 14 pt
                              • Left: 53 pt
                              • Bottom: 44 pt
                              • Right: 188 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Create with Control” ]

                              Scripts:


                              Button PropertiesCoordinatesScript/Script Step
                                Type:
                              • Text: Clear
                              • Top: 536 pt
                              • Left: 900 pt
                              • Bottom: 558 pt
                              • Right: 1002 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Clear” ]

                              Scripts:


                              Portals

                              Portal PropertiesCoordinatesFieldsOptions
                              • Top: 59 pt
                              • Left: 897 pt
                              • Bottom: 411 pt
                              • Right: 1132 pt
                              • Anchoring: Left, Top
                              Field Objects
                              • Sort records: Off
                              • Filter calculation: None
                              • Initial Row: 1
                              • Number of Rows: 14

                              Graphic Objects

                              Graphic Object PropertiesCoordinates
                                Object Name:
                              • PlaceHolder
                                Type:
                              • Rectangle
                                Hide Condition:
                              • 1
                              • Top: 59 pt
                              • Left: 16 pt
                              • Bottom: 522 pt
                              • Right: 886 pt
                              • Anchoring: Left, Top

                              Layout Objects: Points

                              Regular Fields

                              Field Name: Points::PointID
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 54 pt
                              • Left: 7 pt
                              • Bottom: 75 pt
                              • Right: 260 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: Points::Latitude
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 54 pt
                              • Left: 267 pt
                              • Bottom: 75 pt
                              • Right: 373 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: Points::Longitude
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 54 pt
                              • Left: 380 pt
                              • Bottom: 75 pt
                              • Right: 486 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: Points::MapID
                              Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                              • Top: 54 pt
                              • Left: 493 pt
                              • Bottom: 75 pt
                              • Right: 746 pt
                              • Anchoring: Left, Top
                              Field Format:
                              • Edit Box
                              Field Behavior:
                              • Allow field to be entered: In Find mode, In Browse mode
                              • Touch keyboard type: Default for Data Type
                              • Go to next field using: Tab key
                              Yes

                              Script Hierarchy

                              Create with Control
                              Show USA
                              Close
                              Clear
                              Close All
                              Hide
                              Show
                              Remove Annotations
                              Clicked
                              Update Polygon

                              Next Script: [Show USA]
                              Script NameCreate with Control
                              Run script with full access privilegesOff
                              Include In MenuYes
                              Layouts that use this script
                              Scripts that use this script
                                Script Definition
                                Script Steps
                                • #Create MapView with a control called "PlaceHolder"
                                • Set Variable [ $$MapView; Value:MBS("MapView.CreateWithControl"; 0; "PlaceHolder") ]
                                • #Set the scripttrigger. If you click into the Mapview the script "Clicked" will be called
                                • Set Variable [ $r; Value:MBS("MapView.SetScript"; $$MapView; Get(FileName); "Clicked") ]
                                • #show USA
                                • Set Variable [ $r; Value:MBS( "MapView.SetCoordinate"; $$MapView; 39,5; -101,5; 3; 1 ) ]
                                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 with Control]Next Script: [Close]
                                              Script NameShow USA
                                              Run script with full access privilegesOff
                                              Include In MenuYes
                                              Layouts that use this script
                                                Scripts that use this script
                                                  Script Definition
                                                  Script Steps
                                                  • #Set the coordinates of the area you want to see (here USA)
                                                  • Set Variable [ $r; Value:MBS( "MapView.SetCoordinate"; $$MapView; 39,5; -101,5; 4; 1 ) ]
                                                  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: [Show USA]Next Script: [Clear]
                                                                Script NameClose
                                                                Run script with full access privilegesOff
                                                                Include In MenuYes
                                                                Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • #Release of the MapView
                                                                    • If [ Length ( $$MapView) > 0 ]
                                                                    • Set Variable [ $r; Value:MBS("MapView.Release"; $$MapView) ]
                                                                    • Set Variable [ $$MapView; Value:"" ]
                                                                    • 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: [Close]Next Script: [Close All]
                                                                                  Script NameClear
                                                                                  Run script with full access privilegesOff
                                                                                  Include In MenuNo
                                                                                  Layouts that use this script
                                                                                  Scripts that use this script
                                                                                    Script Definition
                                                                                    Script Steps
                                                                                    • #Delete all points we have save in our list and remove all pins and the overlay from the map
                                                                                    • Truncate Table [ No dialog; Table: “Points” ]
                                                                                    • If [ Length ( $$MapView ) > 0 ]
                                                                                    • Set Variable [ $r; Value:MBS( "MapView.RemoveAnnotations"; $$MapView ) ]
                                                                                    • Set Variable [ $r; Value:MBS( "MapView.RemoveOverlays"; $$MapView ) ]
                                                                                    • End If
                                                                                    • Set Variable [ $$Polygon; Value:"" ]
                                                                                    • #remove the last JSON from a click
                                                                                    • Set Field [ MapView::Clicked; "" ]
                                                                                    • Commit Records/Requests [ 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]Next Script: [Hide]
                                                                                            Script NameClose All
                                                                                            Run script with full access privilegesOff
                                                                                            Include In MenuYes
                                                                                            Layouts that use this script
                                                                                              Scripts that use this script
                                                                                                Script Definition
                                                                                                Script Steps
                                                                                                • #Release all MapViews in our solution
                                                                                                • Set Variable [ $r; Value:MBS("MapView.ReleaseAll") ]
                                                                                                • Set Variable [ $$MapView; Value:"" ]
                                                                                                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: [Close All]Next Script: [Show]
                                                                                                              Script NameHide
                                                                                                              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: [Hide]Next Script: [Remove Annotations]
                                                                                                                                Script NameShow
                                                                                                                                Run script with full access privilegesOff
                                                                                                                                Include In MenuYes
                                                                                                                                Layouts that use this script
                                                                                                                                  Scripts that use this script
                                                                                                                                    Script Definition
                                                                                                                                    Script Steps
                                                                                                                                    • #Set the Mapview if it was hide visible
                                                                                                                                    • Set Variable [ $r; Value:MBS("MapView.SetVisible"; $$MapView; 1) ]
                                                                                                                                    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: [Show]Next Script: [Clicked]
                                                                                                                                                  Script NameRemove Annotations
                                                                                                                                                  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: [Remove Annotations]Next Script: [Update Polygon]
                                                                                                                                                                    Script NameClicked
                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                        Script Definition
                                                                                                                                                                        Script Steps
                                                                                                                                                                        • #Script called by mouse clicks in map
                                                                                                                                                                        • Set Variable [ $json; Value:Get(ScriptParameter) ]
                                                                                                                                                                        • #With every click we got a JSON with informations about the click, we seperate this informations and save it in Variabels
                                                                                                                                                                        • Set Field [ MapView::Clicked; $json ]
                                                                                                                                                                        • If [ Length ( $json ) = "" ]
                                                                                                                                                                        • #run without parameter?
                                                                                                                                                                        • Exit Script [ ]
                                                                                                                                                                        • End If
                                                                                                                                                                        • #clicked on something?
                                                                                                                                                                        • Set Variable [ $latitude; Value:JSONGetElement ( $json ; "latitude" ) ]
                                                                                                                                                                        • Set Variable [ $longitude; Value:JSONGetElement ( $json ; "longitude" ) ]
                                                                                                                                                                        • Set Variable [ $reason; Value:JSONGetElement ( $json ; "reason" ) ]
                                                                                                                                                                        • Set Variable [ $annotationIdentifier; Value:JSONGetElement ( $json ; "annotationIdentifier" ) ]
                                                                                                                                                                        • #If we moved the annotaion this part will run
                                                                                                                                                                        • If [ $reason = "AnnotationMoved" ]
                                                                                                                                                                        • #update a coordinate
                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "FM.UpdateRecord"; Get(FileName); "Points"; "PointID"; $AnnotationIdentifier; "Latitude"; $latitude; "Longitude"; $longitude ) ]
                                                                                                                                                                        • If [ Length ( $$polygon ) > 0 ]
                                                                                                                                                                        • Perform Script [ “Update Polygon” ]
                                                                                                                                                                        • End If
                                                                                                                                                                        • Exit Script [ ]
                                                                                                                                                                        • Else If [ $reason = "AnnotationSelected" ]
                                                                                                                                                                        • #do nothing?
                                                                                                                                                                        • Exit Script [ ]
                                                                                                                                                                        • Else If [ $reason = "Click" or $reason = "Touch" ]
                                                                                                                                                                        • #add new point to record
                                                                                                                                                                        • Set Variable [ $mapID; Value:MapView::MapID ]
                                                                                                                                                                        • Go to Layout [ “Points” (Points) ]
                                                                                                                                                                        • New Record/Request
                                                                                                                                                                        • Set Field [ Points::Latitude; $latitude ]
                                                                                                                                                                        • Set Field [ Points::Longitude; $longitude ]
                                                                                                                                                                        • Set Field [ Points::MapID; $mapID ]
                                                                                                                                                                        • Commit Records/Requests [ No dialog ]
                                                                                                                                                                        • Set Variable [ $annotationUUID; Value:Points::PointID ]
                                                                                                                                                                        • Go to Layout [ original layout ]
                                                                                                                                                                        • #add new point
                                                                                                                                                                        • Set Variable [ $j; Value:"{}" ]
                                                                                                                                                                        • Set Variable [ $j; Value:JSONSetElement ( $j ; "longitude" ; $longitude; JSONNumber ) ]
                                                                                                                                                                        • Set Variable [ $j; Value:JSONSetElement ( $j ; "latitude" ; $latitude; JSONNumber ) ]
                                                                                                                                                                        • Set Variable [ $j; Value:JSONSetElement ( $j ; "draggable" ; 1; JSONNumber ) ]
                                                                                                                                                                        • Set Variable [ $j; Value:JSONSetElement ( $j ; "identifier" ; $annotationUUID; JSONString ) ]
                                                                                                                                                                        • Set Variable [ $annotationIdentifier; Value:MBS( "MapView.AddPoint"; $$MapView; $j ) ]
                                                                                                                                                                        • #add new polygon
                                                                                                                                                                        • Set Variable [ $n; Value:"{}" ]
                                                                                                                                                                        • Set Variable [ $n; Value:JSONSetElement ( $n ; "longitude" ; $longitude; JSONNumber ) ]
                                                                                                                                                                        • Set Variable [ $n; Value:JSONSetElement ( $n ; "latitude" ; $latitude; JSONNumber ) ]
                                                                                                                                                                        • If [ Length ( $$polygon ) = 0 ]
                                                                                                                                                                        • #create polygon
                                                                                                                                                                        • Set Variable [ $a; Value:"[]" ]
                                                                                                                                                                        • Set Variable [ $a; Value:MBS( "JSON.AddItemToArray"; $a; $n ) ]
                                                                                                                                                                        • Set Variable [ $j; Value:"{ \"strokeColor\": \"#FF000077\" }" ]
                                                                                                                                                                        • Set Variable [ $j; Value:MBS( "JSON.AddItemToObject"; $j; "coordinates"; $a ) ]
                                                                                                                                                                        • Set Variable [ $$polygon; Value:MBS( "MapView.AddPolygon"; $$MapView; $j ) ]
                                                                                                                                                                        • Else
                                                                                                                                                                        • #update points
                                                                                                                                                                        • Set Variable [ $j; Value:MBS( "MapView.GetOverlayPoints"; $$MapView; $$polygon) ]
                                                                                                                                                                        • If [ MBS("IsError") = 0 ]
                                                                                                                                                                        • Set Variable [ $j; Value:JSONGetElement ( $j ; "points" ) ]
                                                                                                                                                                        • Set Variable [ $j; Value:MBS( "JSON.AddItemToArray"; $j; $n ) ]
                                                                                                                                                                        • Set Variable [ $r; Value:MBS( "MapView.SetOverlayPoints"; $$MapView; $$polygon; $j ) ]
                                                                                                                                                                        • End If
                                                                                                                                                                        • 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: [Clicked]
                                                                                                                                                                            Script NameUpdate Polygon
                                                                                                                                                                            Run script with full access privilegesOff
                                                                                                                                                                            Include In MenuYes
                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                              Script Definition
                                                                                                                                                                              Script Steps
                                                                                                                                                                              • #update polygon from records
                                                                                                                                                                              • Set Variable [ $a; Value:"[]" ]
                                                                                                                                                                              • Go to Related Record [ From table: “Points”; Using layout: “Points” (Points) ]
                                                                                                                                                                              • Go to Record/Request/Page [ First ]
                                                                                                                                                                              • Loop
                                                                                                                                                                              • Set Variable [ $j; Value:"{}" ]
                                                                                                                                                                              • Set Variable [ $j; Value:JSONSetElement ( $j ; "longitude" ; Points::Longitude; JSONNumber ) ]
                                                                                                                                                                              • Set Variable [ $j; Value:JSONSetElement ( $j ; "latitude" ; Points::Latitude; JSONNumber ) ]
                                                                                                                                                                              • Set Variable [ $a; Value:MBS( "JSON.AddItemToArray"; $a; $j ) ]
                                                                                                                                                                              • Go to Record/Request/Page [ Next; Exit after last ]
                                                                                                                                                                              • End Loop
                                                                                                                                                                              • Go to Layout [ original layout ]
                                                                                                                                                                              • Set Variable [ $r; Value:MBS( "MapView.SetOverlayPoints"; $$MapView; $$polygon; $a ) ]
                                                                                                                                                                              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: MapView Click Polygons

                                                                                                                                                                                    Used functions:




                                                                                                                                                                                    Links
                                                                                                                                                                                    MBS Xojo PDF Plugins