MBS FileMaker Plugin Example Databases

Google Maps API

All examples are included with download of MBS FileMaker Plugin.

Google Maps API.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts1
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
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Google Maps API
8 fields defined, 2 records
Google Maps API

Fields

Table Name: Google Maps API - 8 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
API KeyNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Global
  • Repetitions: 1
  • Index Language: German
      Address to queryNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          LatitudeNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              LongitudeNormal, TextAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  ResultNormal, TextAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      Debug MessagesNormal, TextAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German
                          JSONNormal, TextAuto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                              FoundNormal, TextAuto-Enter:
                              • Allow editing
                              Validation:
                              • Only during data entry
                              Storage:
                              • Repetitions: 1
                              • Indexing: None
                              • Automatically create indexes as needed
                              • Index Language: German

                                  Layout Objects: Google Maps API

                                  Regular Fields

                                  Field Name: Google Maps API::API Key
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 8 pt
                                  • Left: 761 pt
                                  • Bottom: 29 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
                                  No

                                  Field Name: Google Maps API::Address to query
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 69 pt
                                  • Left: 148 pt
                                  • Bottom: 90 pt
                                  • Right: 401 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: Google Maps API::Latitude
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 92 pt
                                  • Left: 148 pt
                                  • Bottom: 113 pt
                                  • Right: 401 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: Google Maps API::Longitude
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 115 pt
                                  • Left: 148 pt
                                  • Bottom: 136 pt
                                  • Right: 401 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: Google Maps API::Result
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 138 pt
                                  • Left: 148 pt
                                  • Bottom: 159 pt
                                  • Right: 401 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: Google Maps API::Debug Messages
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 226 pt
                                  • Left: 148 pt
                                  • Bottom: 513 pt
                                  • Right: 401 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: Google Maps API::JSON
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 226 pt
                                  • Left: 508 pt
                                  • Bottom: 513 pt
                                  • Right: 987 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: Google Maps API::Found
                                  Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                  • Top: 71 pt
                                  • Left: 728 pt
                                  • Bottom: 189 pt
                                  • Right: 981 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: Query
                                  • Top: 71 pt
                                  • Left: 452 pt
                                  • Bottom: 102 pt
                                  • Right: 607 pt
                                  • Anchoring: Left, Top
                                  Perform Script [ “Query” ]

                                  Scripts:


                                  Button PropertiesCoordinatesScript/Script Step
                                    Type:
                                  • Text: Open Documentation
                                  • Top: 113 pt
                                  • Left: 452 pt
                                  • Bottom: 144 pt
                                  • Right: 607 pt
                                  • Anchoring: Left, Top
                                  Open URL [ "https://developers.google.com/maps/documentation/geocoding/intro" ] [ No dialog ]

                                  Button PropertiesCoordinatesScript/Script Step
                                    Type:
                                  • Text: Request API Key
                                  • Top: 155 pt
                                  • Left: 452 pt
                                  • Bottom: 186 pt
                                  • Right: 607 pt
                                  • Anchoring: Left, Top
                                  Open URL [ "https://developers.google.com/maps/documentation/geocoding/get-api-key" ] [ No dialog ]

                                  Script Hierarchy

                                  Query

                                  Script NameQuery
                                  Run script with full access privilegesOff
                                  Include In MenuYes
                                  Layouts that use this script
                                  Scripts that use this script
                                    Script Definition
                                    Script Steps
                                    • If [ Length(Google Maps API::API Key) = 0 ]
                                    • Show Custom Dialog [ Message: "Please get an API key from Google."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                    • Open URL [ "https://developers.google.com/maps/documentation/geocoding/get-api-key" ] [ No dialog ]
                                    • Exit Script [ ]
                                    • End If
                                    • #Start new session
                                    • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                    • #Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)
                                    • Set Variable [ $result; Value:MBS("CURL.SetOptionURL"; $curl; "https://maps.googleapis.com/maps/api/geocode/json?address=" & MBS("Text.EncodeToURL"; Substitute(Google Maps API::Address to query; ¶; ", "); "utf8") & "&key=" & Google Maps API::API Key) ]
                                    • #RUN now
                                    • Set Field [ Google Maps API::Result; MBS("CURL.Perform"; $curl) ]
                                    • #Check result
                                    • Set Field [ Google Maps API::JSON; MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                    • Set Field [ Google Maps API::Debug Messages; MBS("CURL.GetDebugAsText"; $curl) ]
                                    • Set Variable [ $httpResult; Value:MBS("CURL.GetResponseCode"; $curl) ]
                                    • Set Variable [ $status; Value:MBS( "JSON.GetPathItem"; Google Maps API::JSON; "status"; 1 ) ]
                                    • If [ $status = "OK" ]
                                    • Set Field [ Google Maps API::Latitude; MBS( "JSON.GetPathItem"; Google Maps API::JSON; "results¶0¶geometry¶location¶lat"; 1 ) ]
                                    • Set Field [ Google Maps API::Longitude; MBS( "JSON.GetPathItem"; Google Maps API::JSON; "results¶0¶geometry¶location¶lng"; 1 ) ]
                                    • Set Field [ Google Maps API::Found; MBS( "JSON.GetPathItem"; Google Maps API::JSON; "results¶0¶formatted_address"; 1 ) ]
                                    • Else
                                    • Set Field [ Google Maps API::Latitude; "" ]
                                    • Set Field [ Google Maps API::Longitude; "" ]
                                    • Set Field [ Google Maps API::Found; "" ]
                                    • End If
                                    • #Cleanup
                                    • Set Variable [ $result; Value:MBS("CURL.Cleanup"; $curl) ]
                                    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: Google Maps API

                                            Used functions:




                                            Links
                                            MBS FileMaker blog