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

MBS FileMaker Plugin Example Databases

SQLite fun

All examples are included with download of MBS FileMaker Plugin.

SQLite fun.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 15
Value Lists 0
Custom Functions 0
Custom Menus 33
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Minimalist
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 Off
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
Comments
Occurrences in Relationship Graph
SQLite fun
7 fields defined, 1 record
SQLite fun

Fields

Table Name: SQLite fun - 7 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
FirstName Normal, Text Auto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      LastName Normal, Text Auto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          Birthday Normal, Date Auto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              NumberOfOrders Normal, Number Auto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  TotalSales Normal, Number Auto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      PathToSQLiteLibrary Normal, Text Auto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Global
                      • Repetitions: 1
                      • Index Language: German
                          PathToSQLiteDatabase Normal, Text Auto-Enter:
                          • Allow editing
                          Validation:
                          • Only during data entry
                          Storage:
                          • Global
                          • Repetitions: 1
                          • Index Language: German

                              Layout Objects: SQLite fun

                              Regular Fields

                              Field Name: SQLite fun::PathToSQLiteLibrary
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 63 pt
                              • Left: 138 pt
                              • Bottom: 82 pt
                              • Right: 391 pt
                              • Anchoring: Left, Top
                              Field Format:
                              • Edit Box
                              Field Behavior:
                              • Allow field to be entered: In Find mode, In Browse mode
                              • Touch keyboard type: System Default
                              • Go to next field using: Tab key
                              No

                              Field Name: SQLite fun::PathToSQLiteDatabase
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 84 pt
                              • Left: 138 pt
                              • Bottom: 103 pt
                              • Right: 391 pt
                              • Anchoring: Left, Top
                              Field Format:
                              • Edit Box
                              Field Behavior:
                              • Allow field to be entered: In Find mode, In Browse mode
                              • Touch keyboard type: System Default
                              • Go to next field using: Tab key
                              No

                              Field Name: SQLite fun::FirstName
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 114 pt
                              • Left: 138 pt
                              • Bottom: 133 pt
                              • Right: 391 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: SQLite fun::LastName
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 137 pt
                              • Left: 138 pt
                              • Bottom: 156 pt
                              • Right: 391 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: SQLite fun::Birthday
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 160 pt
                              • Left: 138 pt
                              • Bottom: 179 pt
                              • Right: 391 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: SQLite fun::NumberOfOrders
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 183 pt
                              • Left: 138 pt
                              • Bottom: 202 pt
                              • Right: 391 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: SQLite fun::TotalSales
                              Field Properties Coordinates Field Format Field Behavior Quick Find
                              • Top: 206 pt
                              • Left: 138 pt
                              • Bottom: 225 pt
                              • Right: 391 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 Properties Coordinates Script/Script Step
                                Type:
                              • Text: Create SQLite Database
                              • Top: 12 pt
                              • Left: 9 pt
                              • Bottom: 38 pt
                              • Right: 159 pt
                              • Anchoring: Left, Top
                              Perform Script [ “CreateDatabase” ]

                              Scripts:


                              Button Properties Coordinates Script/Script Step
                                Type:
                              • Text: Export selected record to SQLite database
                              • Top: 14 pt
                              • Left: 171 pt
                              • Bottom: 38 pt
                              • Right: 437 pt
                              • Anchoring: Left, Top
                              Perform Script [ “ExportRecord” ]

                              Scripts:


                              Button Properties Coordinates Script/Script Step
                                Type:
                              • Text: Import Records from SQLite Database
                              • Top: 15 pt
                              • Left: 449 pt
                              • Bottom: 38 pt
                              • Right: 683 pt
                              • Anchoring: Left, Top
                              Perform Script [ “Import” ]

                              Scripts:


                              Script Hierarchy

                              CreateDatabase
                              ExportRecord
                              Import
                              OpenDatabase
                              -
                              ExportRecord with JSON
                              Show records as JSON
                              Show each record as JSON
                              -
                              ExportRecord with Matrix
                              ExportRecord with SQL
                              Import with SQL
                              -
                              Insert to Other database
                              Update to Other database

                              Next Script: [ExportRecord]
                              Script Name CreateDatabase
                              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
                                • Perform Script [ “OpenDatabase” ]
                                • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                • #Set encoding to be UTF-8
                                • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "PRAGMA encoding = \"UTF-8\";") ]
                                • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                • #Create a table
                                • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "CREATE TABLE Test(FirstName VARCHAR, LastName VARCHAR, Birthday date, NumberOfOrders integer, TotalSales double)") ]
                                • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                • Set Variable [ $result2; Value:MBS("SQL.Commit"; $Connection) ]
                                • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                • If [ $result ≠ "OK" ]
                                • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                • Else [ ]
                                • Show Custom Dialog [ Message: "Database created."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                • End If
                                • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                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: [CreateDatabase] Next Script: [Import]
                                            Script Name ExportRecord
                                            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
                                              • Perform Script [ “OpenDatabase” ]
                                              • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                              • #Create insert command with setting values
                                              • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "INSERT INTO 'Test' (FirstName, LastName, Birthday, NumberOfOrders, TotalSales) VALUES (:1,:2,:3,:4,:5)") ]
                                              • Set Variable [ $result; Value:MBS("SQL.SetParamAsText"; $Command; 1; SQLite fun::FirstName) ]
                                              • Set Variable [ $result; Value:MBS("SQL.SetParamAsText"; $Command; 2; SQLite fun::LastName) ]
                                              • Set Variable [ $result; Value:MBS("SQL.SetParamAsDate"; $Command; 3; SQLite fun::Birthday) ]
                                              • Set Variable [ $result; Value:MBS("SQL.SetParamAsNumber"; $Command; 4; SQLite fun::NumberOfOrders) ]
                                              • Set Variable [ $result; Value:MBS("SQL.SetParamAsFloat"; $Command; 5; SQLite fun::TotalSales) ]
                                              • #Run it
                                              • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                              • #Cleanup
                                              • Set Variable [ $result2; Value:MBS("SQL.Commit"; $Connection) ]
                                              • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                              • If [ $result ≠ "OK" ]
                                              • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                              • Else [ ]
                                              • Show Custom Dialog [ Message: "Record exported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                              • End If
                                              • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                              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: [ExportRecord] Next Script: [OpenDatabase]
                                                    Script Name Import
                                                    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
                                                      • Perform Script [ “OpenDatabase” ]
                                                      • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                      • #Create select and run it
                                                      • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test") ]
                                                      • #Run it
                                                      • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                                      • If [ $result ≠ "OK" ]
                                                      • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                      • Else [ ]
                                                      • Loop [ Flush: Always ]
                                                      • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
                                                      • Exit Loop If [ $result ≠ 1 ]
                                                      • New Record/Request
                                                      • Set Field [ SQLite fun::FirstName; MBS("SQL.GetFieldAsText"; $command; "FirstName") ]
                                                      • Set Field [ SQLite fun::LastName; MBS("SQL.GetFieldAsText"; $command; "LastName") ]
                                                      • Set Field [ SQLite fun::Birthday; MBS("SQL.GetFieldAsDate"; $command; "Birthday") ]
                                                      • Set Field [ SQLite fun::TotalSales; MBS("SQL.GetFieldAsFloat"; $command; "TotalSales") ]
                                                      • Set Field [ SQLite fun::NumberOfOrders; MBS("SQL.GetFieldAsNumber"; $command; "NumberOfOrders") ]
                                                      • Commit Records/Requests [ No dialog ]
                                                      • End Loop
                                                      • Show Custom Dialog [ Message: "Records imported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                      • End If
                                                      • #Cleanup
                                                      • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                                      • Set Variable [ $result2; Value:MBS("SQL.Commit"; $Connection) ]
                                                      • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                      Fields used in this script
                                                      Scripts used in this script
                                                      Layouts used in this script
                                                        Tables used in this script
                                                        Table occurrences used by this script
                                                        Custom Functions used by this script
                                                          Custom menu set used by this script

                                                            Previous Script: [Import] Next Script: [-]
                                                            Script Name OpenDatabase
                                                            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 [ $Connection; Value:MBS("SQL.NewConnection") ]
                                                              • #Tell plugin where SQLite library is
                                                              • // Set Variable [ $result; Value:MBS("SQL.SetConnectionOption"; $Connection; "SQLITE.LIBS"; SQLite fun::PathToSQLiteLibrary) ]
                                                              • Set Variable [ $result; Value:MBS("SQL.InternalSQLiteLibrary.Activate") ]
                                                              • #Tell plugin we want to use SQLite
                                                              • Set Variable [ $result; Value:MBS("SQL.SetClient"; $Connection; "SQLite") ]
                                                              • #Connect to database in read/write/create mode. Creates new file if none exists.
                                                              • Set Variable [ $result; Value:MBS("SQL.Connect"; $Connection; SQLite fun::PathToSQLiteDatabase) ]
                                                              • If [ $result = "OK" ]
                                                              • Exit Script [ Result: $Connection ]
                                                              • Else [ ]
                                                              • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                              • Set Variable [ $result; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                              • Halt Script
                                                              • End If
                                                              Fields used in this script
                                                              Scripts used in this script
                                                                Layouts used in this script
                                                                  Tables used in this script
                                                                  Table occurrences used by this script
                                                                  Custom Functions used by this script
                                                                    Custom menu set used by this script

                                                                      Previous Script: [OpenDatabase] Next Script: [ExportRecord with JSON]
                                                                      Script Name -
                                                                      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
                                                                            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: [-] Next Script: [Show records as JSON]
                                                                                          Script Name ExportRecord with JSON
                                                                                          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
                                                                                              • Perform Script [ “OpenDatabase” ]
                                                                                              • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                              • #Create insert command with setting values
                                                                                              • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "INSERT INTO 'Test' (FirstName, LastName, Birthday, NumberOfOrders, TotalSales) VALUES (:FirstName,:LastName,:Birthday,:NumberOfOrders,:TotalSales)") ]
                                                                                              • Set Variable [ $json; Value:"{}" ]
                                                                                              • Set Variable [ $json; Value:MBS( "JSON.AddStringToObject"; $json; "FirstName"; SQLite fun::FirstName ) ]
                                                                                              • Set Variable [ $json; Value:MBS( "JSON.AddStringToObject"; $json; "LastName"; SQLite fun::LastName ) ]
                                                                                              • Set Variable [ $json; Value:MBS( "JSON.AddStringToObject"; $json; "Birthday"; SQLite fun::Birthday ) ]
                                                                                              • Set Variable [ $json; Value:MBS( "JSON.AddNumberToObject"; $json; "NumberOfOrders"; SQLite fun::NumberOfOrders ) ]
                                                                                              • Set Variable [ $json; Value:MBS( "JSON.AddNumberToObject"; $json; "TotalSales"; SQLite fun::TotalSales ) ]
                                                                                              • Set Variable [ $result; Value:MBS("SQL.SetParamsWithJSON"; $Command; $json) ]
                                                                                              • #Run it
                                                                                              • Show Custom Dialog [ Title: "JSON"; Message: MBS( "SQL.GetParamsAsJSON"; $Command ); Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                              • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                                                                              • #Cleanup
                                                                                              • Set Variable [ $result2; Value:MBS("SQL.Commit"; $Connection) ]
                                                                                              • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                                                                              • If [ $result ≠ "OK" ]
                                                                                              • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                              • Else [ ]
                                                                                              • Show Custom Dialog [ Message: "Record exported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                              • End If
                                                                                              • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                              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: [ExportRecord with JSON] Next Script: [Show each record as JSON]
                                                                                                    Script Name Show records as JSON
                                                                                                    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
                                                                                                        • Perform Script [ “OpenDatabase” ]
                                                                                                        • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                                        • #Create select and run it
                                                                                                        • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test") ]
                                                                                                        • #Run it
                                                                                                        • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                                                                                        • If [ $result ≠ "OK" ]
                                                                                                        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                        • Else [ ]
                                                                                                        • Show Custom Dialog [ Title: "JSON"; Message: MBS( "SQL.GetRecordsAsJSON"; $Command ); Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                        • End If
                                                                                                        • #Cleanup
                                                                                                        • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                                                                                        • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                                        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 records as JSON] Next Script: [-]
                                                                                                                    Script Name Show each record as JSON
                                                                                                                    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
                                                                                                                        • Perform Script [ “OpenDatabase” ]
                                                                                                                        • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                                                        • #Create select and run it
                                                                                                                        • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test") ]
                                                                                                                        • #Run it
                                                                                                                        • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                                                                                                        • If [ $result ≠ "OK" ]
                                                                                                                        • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                        • Else [ ]
                                                                                                                        • Loop [ Flush: Always ]
                                                                                                                        • Set Variable [ $result; Value:MBS("SQL.FetchNext"; $Command) ]
                                                                                                                        • Exit Loop If [ $result ≠ 1 ]
                                                                                                                        • Show Custom Dialog [ Title: "JSON"; Message: MBS( "SQL.GetFieldsAsJSON"; $Command ); Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                        • End Loop
                                                                                                                        • End If
                                                                                                                        • #Cleanup
                                                                                                                        • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                                                                                                        • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                                                        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 each record as JSON] Next Script: [ExportRecord with Matrix]
                                                                                                                                    Script Name -
                                                                                                                                    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
                                                                                                                                          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: [-] Next Script: [ExportRecord with SQL]
                                                                                                                                                        Script Name ExportRecord with Matrix
                                                                                                                                                        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
                                                                                                                                                            • Perform Script [ “OpenDatabase” ]
                                                                                                                                                            • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                                                                                            • #Create insert command with setting values
                                                                                                                                                            • Set Variable [ $SelectSQL; Value:"SELECT FirstName, LastName, Birthday, NumberOfOrders, TotalSales FROM \"SQLite fun\"" ]
                                                                                                                                                            • Set Variable [ $InsertFields; Value:"FirstName¶LastName¶Birthday¶NumberOfOrders¶TotalSales" ]
                                                                                                                                                            • Set Variable [ $sql; Value:MBS("Matrix.NewWithSQL"; Get(FileName); $SelectSQL) ]
                                                                                                                                                            • If [ MBS("IsError") ]
                                                                                                                                                            • Show Custom Dialog [ Message: "Error: " & $sql; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                            • Else [ ]
                                                                                                                                                            • Set Variable [ $result; Value:MBS("Matrix.InsertRecordsToSQL"; $sql; $Connection; "Test"; $InsertFields) ]
                                                                                                                                                            • If [ MBS("IsError") ]
                                                                                                                                                            • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                            • Else [ ]
                                                                                                                                                            • Show Custom Dialog [ Message: "Record exported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                            • End If
                                                                                                                                                            • End If
                                                                                                                                                            • Set Variable [ $r; Value:MBS("Matrix.Release"; $sql) ]
                                                                                                                                                            • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                                                                                            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: [ExportRecord with Matrix] Next Script: [Import with SQL]
                                                                                                                                                                        Script Name ExportRecord with SQL
                                                                                                                                                                        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
                                                                                                                                                                            • Perform Script [ “OpenDatabase” ]
                                                                                                                                                                            • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                                                                                                            • #Create insert command with setting values
                                                                                                                                                                            • Set Variable [ $SelectSQL; Value:"SELECT FirstName, LastName, Birthday, NumberOfOrders, TotalSales FROM \"SQLite fun\"" ]
                                                                                                                                                                            • Set Variable [ $InsertFields; Value:"FirstName¶LastName¶Birthday¶NumberOfOrders¶TotalSales" ]
                                                                                                                                                                            • Set Variable [ $sql; Value:MBS("FM.SQL.Execute"; Get(FileName); $SelectSQL) ]
                                                                                                                                                                            • If [ MBS("IsError") ]
                                                                                                                                                                            • Show Custom Dialog [ Message: "Error: " & $sql; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                            • Else [ ]
                                                                                                                                                                            • Set Variable [ $result; Value:MBS("FM.SQL.InsertRecordsToSQL"; $sql; $Connection; "Test"; $InsertFields) ]
                                                                                                                                                                            • If [ MBS("IsError") ]
                                                                                                                                                                            • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                            • Else [ ]
                                                                                                                                                                            • Show Custom Dialog [ Message: "Record exported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                            • End If
                                                                                                                                                                            • End If
                                                                                                                                                                            • Set Variable [ $r; Value:MBS("FM.SQL.Release"; $sql) ]
                                                                                                                                                                            • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                                                                                                            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: [ExportRecord with SQL] Next Script: [-]
                                                                                                                                                                                        Script Name Import with SQL
                                                                                                                                                                                        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
                                                                                                                                                                                            • Perform Script [ “OpenDatabase” ]
                                                                                                                                                                                            • Set Variable [ $Connection; Value:Get (ScriptResult) ]
                                                                                                                                                                                            • #Create select and run it
                                                                                                                                                                                            • Set Variable [ $SelectSQL; Value:"SELECT FirstName, LastName, Birthday, NumberOfOrders, TotalSales FROM Test" ]
                                                                                                                                                                                            • Set Variable [ $Command; Value:MBS("SQL.NewCommand"; $Connection; $SelectSQL) ]
                                                                                                                                                                                            • #Run it
                                                                                                                                                                                            • Set Variable [ $result; Value:MBS("SQL.Execute"; $Command) ]
                                                                                                                                                                                            • If [ $result ≠ "OK" ]
                                                                                                                                                                                            • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                            • Else [ ]
                                                                                                                                                                                            • #now batch move records
                                                                                                                                                                                            • Set Variable [ $InsertFields; Value:"FirstName¶LastName¶Birthday¶NumberOfOrders¶TotalSales" ]
                                                                                                                                                                                            • Set Variable [ $result; Value:MBS("SQL.InsertRecords"; $Command; Get(FileName); "SQLite fun"; $InsertFields) ]
                                                                                                                                                                                            • Show Custom Dialog [ Title: "Records imported."; Message: $result; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                                            • End If
                                                                                                                                                                                            • #Cleanup
                                                                                                                                                                                            • Set Variable [ $result2; Value:MBS("SQL.FreeCommand"; $Command) ]
                                                                                                                                                                                            • Set Variable [ $result2; Value:MBS("SQL.Commit"; $Connection) ]
                                                                                                                                                                                            • Set Variable [ $result2; Value:MBS("SQL.FreeConnection"; $Connection) ]
                                                                                                                                                                                            Fields used in this script
                                                                                                                                                                                              Scripts used in this script
                                                                                                                                                                                              Layouts used in this script
                                                                                                                                                                                                Tables used in this script
                                                                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                                                                    Custom Functions used by this script
                                                                                                                                                                                                      Custom menu set used by this script

                                                                                                                                                                                                        Previous Script: [Import with SQL] Next Script: [Insert to Other database]
                                                                                                                                                                                                        Script Name -
                                                                                                                                                                                                        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
                                                                                                                                                                                                              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: [-] Next Script: [Update to Other database]
                                                                                                                                                                                                                            Script Name Insert to Other database
                                                                                                                                                                                                                            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
                                                                                                                                                                                                                                • #Duplicate the file and open both
                                                                                                                                                                                                                                • Set Variable [ $SelectSQL; Value:"SELECT FirstName, LastName, Birthday, NumberOfOrders, TotalSales FROM \"SQLite fun\"" ]
                                                                                                                                                                                                                                • Set Variable [ $InsertFields; Value:"FirstName¶LastName¶Birthday¶NumberOfOrders¶TotalSales" ]
                                                                                                                                                                                                                                • Set Variable [ $sql; Value:MBS("Matrix.NewWithSQL"; Get(FileName); $SelectSQL) ]
                                                                                                                                                                                                                                • If [ MBS("IsError") ]
                                                                                                                                                                                                                                • Show Custom Dialog [ Message: "Error: " & $sql; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                • Else [ ]
                                                                                                                                                                                                                                • Set Variable [ $result; Value:MBS("Matrix.InsertRecords"; $sql; "SQLite fun copy"; "SQLite fun"; $InsertFields) ]
                                                                                                                                                                                                                                • If [ MBS("IsError") ]
                                                                                                                                                                                                                                • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                • Else [ ]
                                                                                                                                                                                                                                • Show Custom Dialog [ Message: "Record exported."; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                • End If
                                                                                                                                                                                                                                • End If
                                                                                                                                                                                                                                • Set Variable [ $r; Value:MBS("Matrix.Release"; $sql) ]
                                                                                                                                                                                                                                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: [Insert to Other database]
                                                                                                                                                                                                                                              Script Name Update to Other database
                                                                                                                                                                                                                                              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
                                                                                                                                                                                                                                                  • #Duplicate the file and open both
                                                                                                                                                                                                                                                  • Set Variable [ $SelectSQL; Value:"SELECT FirstName, LastName, Birthday, NumberOfOrders, TotalSales FROM \"SQLite fun\"" ]
                                                                                                                                                                                                                                                  • Set Variable [ $InsertFields; Value:"FirstName¶LastName¶Birthday¶NumberOfOrders¶TotalSales" ]
                                                                                                                                                                                                                                                  • Set Variable [ $sql; Value:MBS("Matrix.NewWithSQL"; Get(FileName); $SelectSQL) ]
                                                                                                                                                                                                                                                  • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                  • Show Custom Dialog [ Message: "Error: " & $sql; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                                  • Else [ ]
                                                                                                                                                                                                                                                  • Set Variable [ $result; Value:MBS("Matrix.InsertOrUpdateRecords"; $sql; "SQLite fun copy"; "SQLite fun"; $InsertFields; "LastName=1") ]
                                                                                                                                                                                                                                                  • If [ MBS("IsError") ]
                                                                                                                                                                                                                                                  • Show Custom Dialog [ Message: "Error: " & $result; Default Button: “OK”, Commit: “No”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                                  • Else [ ]
                                                                                                                                                                                                                                                  • Show Custom Dialog [ Title: "Records updated."; Message: $result; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                                                                                                                                                                                                  • End If
                                                                                                                                                                                                                                                  • End If
                                                                                                                                                                                                                                                  • Set Variable [ $r; Value:MBS("Matrix.Release"; $sql) ]
                                                                                                                                                                                                                                                  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: SQLite fun

                                                                                                                                                                                                                                                                Used functions: