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

MBS FileMaker Plugin Example Databases

MQTT

All examples are included with download of MBS FileMaker Plugin.

MQTT.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 5
Value Lists 0
Custom Functions 0
Custom Menus 24
File Options
Default custom menu set [Standard FileMaker Menus]
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields On
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Off
OnLastWindowClose Off
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
MQTT
11 fields defined, 0 record
MQTT

Fields

Table Name: MQTT - 11 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
PrimaryKey Normal, Text Auto-Enter:
  • Context table: MQTT
    Calculation: Get( UUID )
Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Unique identifier of each record in this table
          CreationTimestamp Normal, Timestamp Auto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Date and time each record was created
                  CreatedBy Normal, Text Auto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Account name of the user who created each record
                          ModificationTimestamp Normal, Timestamp Auto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Date and time each record was last modified
                                  ModifiedBy Normal, Text Auto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Account name of the user who last modified each record
                                          URL Normal, Text Auto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Global
                                          • Repetitions: 1
                                          • Index Language: German
                                              Payload Normal, Text Auto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Global
                                              • Repetitions: 1
                                              • Index Language: German
                                                  Channel Normal, Text Auto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Repetitions: 1
                                                  • Indexing: None
                                                  • Automatically create indexes as needed
                                                  • Index Language: German
                                                      Message Normal, Text Auto-Enter:
                                                      • Allow editing
                                                      Validation:
                                                      • Only during data entry
                                                      Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                          Username Normal, Text Auto-Enter:
                                                          • Allow editing
                                                          Validation:
                                                          • Only during data entry
                                                          Storage:
                                                          • Global
                                                          • Repetitions: 1
                                                          • Index Language: German
                                                              Password Normal, Text Auto-Enter:
                                                              • Allow editing
                                                              Validation:
                                                              • Only during data entry
                                                              Storage:
                                                              • Global
                                                              • Repetitions: 1
                                                              • Index Language: German

                                                                  Layout Objects: MQTT

                                                                  Regular Fields

                                                                  Field Name: MQTT::Channel
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 219 pt
                                                                  • Left: 10 pt
                                                                  • Bottom: 250 pt
                                                                  • Right: 263 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: MQTT::Message
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 219 pt
                                                                  • Left: 271 pt
                                                                  • Bottom: 250 pt
                                                                  • Right: 1015 pt
                                                                  • Anchoring: Left and Right, 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: MQTT::URL
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 50 pt
                                                                  • Left: 143 pt
                                                                  • Bottom: 81 pt
                                                                  • Right: 760 pt
                                                                  • Anchoring: Left and Right, 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: MQTT::Payload
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 85 pt
                                                                  • Left: 143 pt
                                                                  • Bottom: 116 pt
                                                                  • Right: 760 pt
                                                                  • Anchoring: Left and Right, 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: MQTT::Username
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 121 pt
                                                                  • Left: 143 pt
                                                                  • Bottom: 152 pt
                                                                  • Right: 396 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: MQTT::Password
                                                                  Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                  • Top: 121 pt
                                                                  • Left: 507 pt
                                                                  • Bottom: 152 pt
                                                                  • Right: 760 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

                                                                  Buttons

                                                                  Button Properties Coordinates Script/Script Step
                                                                    Type:
                                                                  • Text: Subscribe
                                                                  • Top: 50 pt
                                                                  • Left: 796 pt
                                                                  • Bottom: 81 pt
                                                                  • Right: 955 pt
                                                                  • Anchoring: Right, Top
                                                                  Perform Script [ “Connect” ]

                                                                  Scripts:


                                                                  Button Properties Coordinates Script/Script Step
                                                                    Type:
                                                                  • Text: Send
                                                                  • Top: 84 pt
                                                                  • Left: 796 pt
                                                                  • Bottom: 115 pt
                                                                  • Right: 955 pt
                                                                  • Anchoring: Right, Top
                                                                  Perform Script [ “Send” ]

                                                                  Scripts:


                                                                  Script Hierarchy

                                                                  Connect
                                                                  Send
                                                                  Finished
                                                                  Received
                                                                  Close

                                                                  Next Script: [Send]
                                                                  Script Name Connect
                                                                  Run script with full access privileges Off
                                                                  Siri Shortcut Visible Off
                                                                  Include In Menu Yes
                                                                  Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                    • #connect to MQTT server
                                                                    • Set Variable [ $r; Value:MBS("CURL.SetOptionURL"; $curl; MQTT::URL) ]
                                                                    • Set Variable [ $r; Value:MBS("CURL.SetFinishedScript"; $curl; Get(FileName); "Finished") ]
                                                                    • Set Variable [ $r; Value:MBS("CURL.SetMQTTScript"; $curl; Get(FileName); "Received") ]
                                                                    • Set Variable [ $r; Value:MBS("CURL.SetOptionUsername"; $curl; MQTT::Username) ]
                                                                    • Set Variable [ $r; Value:MBS("CURL.SetOptionPassword"; $curl; MQTT::Password) ]
                                                                    • #run in background
                                                                    • Set Variable [ $result; Value:MBS("CURL.PerformAsync"; $curl) ]
                                                                    • If [ MBS("IsError") ]
                                                                    • Show Custom Dialog [ Title: "Failed to send."; Message: $result; Default Button: “OK”, Commit: “Yes” ]
                                                                    • 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: [Connect] Next Script: [Finished]
                                                                            Script Name Send
                                                                            Run script with full access privileges Off
                                                                            Siri Shortcut Visible Off
                                                                            Include In Menu Yes
                                                                            Layouts that use this script
                                                                            Scripts that use this script
                                                                              Script Definition
                                                                              Script Steps
                                                                              • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                              • #connect to MQTT server and send
                                                                              • Set Variable [ $r; Value:MBS("CURL.SetOptionURL"; $curl; MQTT::URL) ]
                                                                              • Set Variable [ $r; Value:MBS("CURL.SetOptionPostFields"; $curl; MQTT::Payload; "UTF-8") ]
                                                                              • Set Variable [ $r; Value:MBS("CURL.SetOptionUsername"; $curl; MQTT::Username) ]
                                                                              • Set Variable [ $r; Value:MBS("CURL.SetOptionPassword"; $curl; MQTT::Password) ]
                                                                              • #send request now
                                                                              • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                              • If [ MBS("IsError") ]
                                                                              • Show Custom Dialog [ Title: "Failed to send."; Message: $result; Default Button: “OK”, Commit: “Yes” ]
                                                                              • End If
                                                                              • #for checking error details
                                                                              • Set Variable [ $$debugLog; Value:MBS("CURL.GetDebugMessages"; $curl; "UTF-8") ]
                                                                              • Set Variable [ $$output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF-8") ]
                                                                              • Set Variable [ $r; Value:MBS("CURL.Release"; $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

                                                                                      Previous Script: [Send] Next Script: [Received]
                                                                                      Script Name Finished
                                                                                      Run script with full access privileges Off
                                                                                      Siri Shortcut Visible Off
                                                                                      Include In Menu Yes
                                                                                      Layouts that use this script
                                                                                        Scripts that use this script
                                                                                          Script Definition
                                                                                          Script Steps
                                                                                          • #server closed connection
                                                                                          • Set Variable [ $curl; Value:Get(ScriptParameter) ]
                                                                                          • Set Variable [ $$debugLog; Value:MBS("CURL.GetDebugMessages"; $curl; "UTF-8") ]
                                                                                          • Set Variable [ $$output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF-8") ]
                                                                                          • Set Variable [ $r; Value:MBS("CURL.Release"; $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

                                                                                                        Previous Script: [Finished] Next Script: [Close]
                                                                                                        Script Name Received
                                                                                                        Run script with full access privileges Off
                                                                                                        Siri Shortcut Visible Off
                                                                                                        Include In Menu Yes
                                                                                                        Layouts that use this script
                                                                                                          Scripts that use this script
                                                                                                            Script Definition
                                                                                                            Script Steps
                                                                                                            • Set Variable [ $curl; Value:Get(ScriptParameter) ]
                                                                                                            • Set Variable [ $json; Value:MBS("CURL.GetMQTTMessages"; $curl) ]
                                                                                                            • Set Variable [ $count; Value:MBS("JSON.GetArraySize"; $json) ]
                                                                                                            • Set Variable [ $index; Value:0 ]
                                                                                                            • If [ $index < $count ]
                                                                                                            • Loop [ Flush: Always ]
                                                                                                            • Set Variable [ $entry; Value:MBS("JSON.GetArrayItem"; $json; $index) ]
                                                                                                            • New Record/Request
                                                                                                            • Set Field [ MQTT::Channel; MBS("JSON.GetPathItem"; $entry; "topic"; 3) ]
                                                                                                            • Set Field [ MQTT::Message; MBS("JSON.GetPathItem"; $entry; "content"; 3) ]
                                                                                                            • Commit Records/Requests [ No dialog ]
                                                                                                            • #next
                                                                                                            • Set Variable [ $index; Value:$index + 1 ]
                                                                                                            • Exit Loop If [ $index ≥ $count ]
                                                                                                            • End Loop
                                                                                                            • 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: [Received]
                                                                                                                    Script Name Close
                                                                                                                    Run script with full access privileges Off
                                                                                                                    Siri Shortcut Visible Off
                                                                                                                    Include In Menu Yes
                                                                                                                    Layouts that use this script
                                                                                                                      Scripts that use this script
                                                                                                                        Script Definition
                                                                                                                        Script Steps
                                                                                                                        • #check if we have something
                                                                                                                        • Set Variable [ $list; Value:MBS("Curl.List") ]
                                                                                                                        • #and stop first one
                                                                                                                        • Set Variable [ $curl; Value:GetValue($list; 1) ]
                                                                                                                        • Set Variable [ $r; Value:MBS("CURL.SetFinishedScript"; $curl; ""; "") ]
                                                                                                                        • Set Variable [ $r; Value:MBS("Curl.Cancel"; $curl) ]
                                                                                                                        • #after short delay to let curl cleanup, we try to close it
                                                                                                                        • Pause/Resume Script [ Duration (seconds): ,3 ]
                                                                                                                        • Set Variable [ $r; Value:MBS("Curl.Release"; $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: MQTT

                                                                                                                                      Used functions: