MBS FileMaker Plugin Example Databases

Sort Benchmark

All examples are included with download of MBS FileMaker Plugin.

Sort Benchmark.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts15
Value Lists0
Custom Functions3
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
Sort Benchmark
6 fields defined, 1 record
Sort Benchmark

Fields

Table Name: Sort Benchmark - 6 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      OutputNormal, TextAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
      • Indexing: None
      • Automatically create indexes as needed
      • Index Language: German
          TimeNormal, NumberAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              Input LengthNormal, NumberAuto-Enter: Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  Output LengthNormal, NumberAuto-Enter: Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                      RoundsNormal, NumberAuto-Enter:
                      • Allow editing
                      Validation:
                      • Only during data entry
                      Storage:
                      • Repetitions: 1
                      • Indexing: None
                      • Automatically create indexes as needed
                      • Index Language: German

                          Layout Objects: Sort Benchmark

                          Regular Fields

                          Field Name: Sort Benchmark::Input
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 52 pt
                          • Left: 138 pt
                          • Bottom: 255 pt
                          • Right: 549 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: Sort Benchmark::Output
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 264 pt
                          • Left: 138 pt
                          • Bottom: 467 pt
                          • Right: 549 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: Sort Benchmark::Time
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 469 pt
                          • Left: 138 pt
                          • Bottom: 490 pt
                          • Right: 217 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: Sort Benchmark::Input Length
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 82 pt
                          • Left: 48 pt
                          • Bottom: 103 pt
                          • Right: 127 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: Sort Benchmark::Output Length
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 285 pt
                          • Left: 48 pt
                          • Bottom: 306 pt
                          • Right: 127 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: Sort Benchmark::Rounds
                          Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                          • Top: 492 pt
                          • Left: 138 pt
                          • Bottom: 513 pt
                          • Right: 217 pt
                          • Anchoring: Left, Top
                          Field Format:
                          • Edit Box
                          Field Behavior:
                          • Allow field to be entered: In Find mode, In Browse mode
                          • Touch keyboard type: Default for Data Type
                          • Go to next field using: Tab key
                          Yes

                          Buttons

                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Generate 1000 input values
                          • Top: 90 pt
                          • Left: 590 pt
                          • Bottom: 120 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with FileMaker”; Parameter: 1000 ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Generate 10000 input values
                          • Top: 129 pt
                          • Left: 590 pt
                          • Bottom: 159 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with FileMaker”; Parameter: 10000 ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: SortValues in FileMaker
                          • Top: 191 pt
                          • Left: 590 pt
                          • Bottom: 221 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Sort in FileMaker” ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Sort with Custom Function
                          • Top: 234 pt
                          • Left: 590 pt
                          • Bottom: 264 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Sort with Custom Function” ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Generate 100 input values
                          • Top: 52 pt
                          • Left: 590 pt
                          • Bottom: 82 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with FileMaker”; Parameter: 100 ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Sort with MBS List
                          • Top: 276 pt
                          • Left: 590 pt
                          • Bottom: 306 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Sort with MBS List” ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Sort with MBS JavaScript
                          • Top: 318 pt
                          • Left: 590 pt
                          • Bottom: 348 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Sort with MBS JavaScript” ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: Sort with MBS Webviewer
                          • Top: 360 pt
                          • Left: 590 pt
                          • Bottom: 390 pt
                          • Right: 808 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Sort with MBS Webviewer” ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: with MBS
                          • Top: 90 pt
                          • Left: 818 pt
                          • Bottom: 120 pt
                          • Right: 905 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with MBS”; Parameter: 1000 ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: with MBS
                          • Top: 129 pt
                          • Left: 818 pt
                          • Bottom: 159 pt
                          • Right: 905 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with MBS”; Parameter: 10000 ]

                          Scripts:


                          Button PropertiesCoordinatesScript/Script Step
                            Type:
                          • Text: with MBS
                          • Top: 52 pt
                          • Left: 818 pt
                          • Bottom: 82 pt
                          • Right: 905 pt
                          • Anchoring: Left, Top
                          Perform Script [ “Generate Input Values with MBS”; Parameter: 100 ]

                          Scripts:


                          Web Viewer Controls

                          Web Viewer Control PropertiesCoordinatesWeb Address
                            Object Name:
                          • web
                            Additional Properties:
                          • Allow interaction with web viewer content
                          • Display progress bar
                          • Display status messages
                          • Automatically encode URL
                          • Top: 433 pt
                          • Left: 666 pt
                          • Bottom: 454 pt
                          • Right: 734 pt
                          • Anchoring: Left, Top
                          "about:blank"

                          Script Hierarchy

                          Generate Input Values with FileMaker
                          Generate Input Values with MBS
                          Trace Off
                          Clear
                          -
                          Sort in FileMaker
                          Sort with Custom Function
                          Sort with MBS List
                          Sort with MBS JavaScript
                          Sort with MBS Webviewer
                          -
                          Sort in FileMaker 2
                          Sort with MBS List 2
                          Sort with MBS JavaScript 2
                          Sort with MBS Webviewer 2

                          Next Script: [Generate Input Values with MBS]
                          Script NameGenerate Input Values with FileMaker
                          Run script with full access privilegesOff
                          Include In MenuYes
                          Layouts that use this script
                          Scripts that use this script
                            Script Definition
                            Script Steps
                            • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                            • Set Variable [ $list; Value:"" ]
                            • #loop counting up from 1 to $count
                            • Set Variable [ $count; Value:GetAsNumber(Get(ScriptParameter)) ]
                            • Set Variable [ $index; Value:1 ]
                            • If [ $index ≤ $count ]
                            • Loop
                            • #your script steps here
                            • Set Variable [ $list; Value:$list & (Get(UUID) & ¶ ) ]
                            • #next
                            • Set Variable [ $index; Value:$index + 1 ]
                            • Exit Loop If [ $index > $count ]
                            • End Loop
                            • End If
                            • Set Field [ Sort Benchmark::Input; MBS("Text.Trim"; $List) ]
                            • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                            • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) ]
                            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: [Generate Input Values with FileMaker]Next Script: [Trace Off]
                                    Script NameGenerate Input Values with MBS
                                    Run script with full access privilegesOff
                                    Include In MenuYes
                                    Layouts that use this script
                                    Scripts that use this script
                                      Script Definition
                                      Script Steps
                                      • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                      • Set Variable [ $list; Value:MBS( "QuickList.New") ]
                                      • #loop counting up from 1 to $count
                                      • Set Variable [ $count; Value:GetAsNumber(Get(ScriptParameter)) ]
                                      • Set Variable [ $r ]
                                      • Set Variable [ $index; Value:1 ]
                                      • If [ $index ≤ $count ]
                                      • Loop
                                      • #your script steps here
                                      • Set Variable [ $r; Value:MBS( "QuickList.AddValue"; $list; Get(UUID) ) ]
                                      • #next
                                      • Set Variable [ $index; Value:$index + 1 ]
                                      • Exit Loop If [ $index > $count ]
                                      • End Loop
                                      • End If
                                      • Set Field [ Sort Benchmark::Input; MBS( "QuickList.GetList"; $list; 1; ¶) ]
                                      • Set Variable [ $r; Value:MBS( "QuickList.Free"; $list ) ]
                                      • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                      • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) ]
                                      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: [Generate Input Values with MBS]Next Script: [Clear]
                                              Script NameTrace Off
                                              Run script with full access privilegesOff
                                              Include In MenuYes
                                              Layouts that use this script
                                                Scripts that use this script
                                                  Script Definition
                                                  Script Steps
                                                  • Set Variable [ $r; Value:MBS("Trace.Off") ]
                                                  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: [Trace Off]Next Script: [-]
                                                                Script NameClear
                                                                Run script with full access privilegesOff
                                                                Include In MenuYes
                                                                Layouts that use this script
                                                                  Scripts that use this script
                                                                    Script Definition
                                                                    Script Steps
                                                                    • Set Field [ Sort Benchmark::Input; "" ]
                                                                    • Set Field [ Sort Benchmark::Output; "" ]
                                                                    • Set Field [ Sort Benchmark::Input Length; "" ]
                                                                    • Set Field [ Sort Benchmark::Output Length; "" ]
                                                                    • Set Field [ Sort Benchmark::Time; "" ]
                                                                    Fields used in this script
                                                                    Scripts used in this script
                                                                      Layouts used in this script
                                                                        Tables used in this script
                                                                        Table occurrences used by this script
                                                                        Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [Clear]Next Script: [Sort in FileMaker]
                                                                            Script Name-
                                                                            Run script with full access privilegesOff
                                                                            Include In MenuYes
                                                                            Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                  Fields used in this script
                                                                                    Scripts used in this script
                                                                                      Layouts used in this script
                                                                                        Tables used in this script
                                                                                          Table occurrences used by this script
                                                                                            Custom Functions used by this script
                                                                                              Custom menu set used by this script

                                                                                                Previous Script: [-]Next Script: [Sort with Custom Function]
                                                                                                Script NameSort in FileMaker
                                                                                                Run script with full access privilegesOff
                                                                                                Include In MenuYes
                                                                                                Layouts that use this script
                                                                                                Scripts that use this script
                                                                                                  Script Definition
                                                                                                  Script Steps
                                                                                                  • #Sort using FileMaker's sort function
                                                                                                  • Set Field [ Sort Benchmark::Output; "" ]
                                                                                                  • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                  • #Run Sort 10 times, so we can get a better average time
                                                                                                  • Set Variable [ $count; Value:Sort Benchmark::Rounds ]
                                                                                                  • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                  • Set Variable [ $index; Value:1 ]
                                                                                                  • If [ $index ≤ $count ]
                                                                                                  • Loop
                                                                                                  • #your script steps here
                                                                                                  • Set Variable [ $Sort; Value:SortValues ( $Input ) ]
                                                                                                  • #next
                                                                                                  • Set Variable [ $index; Value:$index + 1 ]
                                                                                                  • Exit Loop If [ $index > $count ]
                                                                                                  • End Loop
                                                                                                  • End If
                                                                                                  • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                  • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                  • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) / $count ]
                                                                                                  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: [Sort in FileMaker]Next Script: [Sort with MBS List]
                                                                                                          Script NameSort with Custom Function
                                                                                                          Run script with full access privilegesOff
                                                                                                          Include In MenuYes
                                                                                                          Layouts that use this script
                                                                                                          Scripts that use this script
                                                                                                            Script Definition
                                                                                                            Script Steps
                                                                                                            • #Sort using FileMaker's sort function
                                                                                                            • Set Field [ Sort Benchmark::Output; "" ]
                                                                                                            • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                            • If [ ValueCount ( Sort Benchmark::Input ) > 1000 ]
                                                                                                            • Show Custom Dialog [ Title: "Too many values"; Message: "Please only try with 100 values"; Default Button: “OK”, Commit: “Yes” ]
                                                                                                            • Exit Script [ ]
                                                                                                            • End If
                                                                                                            • #Run Sort one time as this is slow
                                                                                                            • Set Variable [ $count; Value:1 ]
                                                                                                            • Set Variable [ $index; Value:1 ]
                                                                                                            • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                            • If [ $index ≤ $count ]
                                                                                                            • Loop
                                                                                                            • #your script steps here
                                                                                                            • Set Variable [ $Sort; Value:QuickSort ( $Input ) ]
                                                                                                            • #next
                                                                                                            • Set Variable [ $index; Value:$index + 1 ]
                                                                                                            • Exit Loop If [ $index > $count ]
                                                                                                            • End Loop
                                                                                                            • End If
                                                                                                            • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                            • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                            • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) / $count ]
                                                                                                            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: [Sort with Custom Function]Next Script: [Sort with MBS JavaScript]
                                                                                                                  Script NameSort with MBS List
                                                                                                                  Run script with full access privilegesOff
                                                                                                                  Include In MenuYes
                                                                                                                  Layouts that use this script
                                                                                                                  Scripts that use this script
                                                                                                                    Script Definition
                                                                                                                    Script Steps
                                                                                                                    • #Sort via List functions in MBS Plugin
                                                                                                                    • Set Field [ Sort Benchmark::Output; "" ]
                                                                                                                    • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                    • #Run Sort 10 times, so we can get a better average time
                                                                                                                    • Set Variable [ $count; Value:Sort Benchmark::Rounds ]
                                                                                                                    • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                    • Set Variable [ $index; Value:1 ]
                                                                                                                    • If [ $index ≤ $count ]
                                                                                                                    • Loop
                                                                                                                    • #your script steps here
                                                                                                                    • Set Variable [ $Sort; Value:MBS( "List.Sort"; $Input) ]
                                                                                                                    • #next
                                                                                                                    • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                    • Exit Loop If [ $index > $count ]
                                                                                                                    • End Loop
                                                                                                                    • End If
                                                                                                                    • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                    • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                    • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) / $count ]
                                                                                                                    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: [Sort with MBS List]Next Script: [Sort with MBS Webviewer]
                                                                                                                            Script NameSort with MBS JavaScript
                                                                                                                            Run script with full access privilegesOff
                                                                                                                            Include In MenuYes
                                                                                                                            Layouts that use this script
                                                                                                                            Scripts that use this script
                                                                                                                              Script Definition
                                                                                                                              Script Steps
                                                                                                                              • #Sort via MBS Plugin and JavaScript engine
                                                                                                                              • Set Field [ Sort Benchmark::Output; "" ]
                                                                                                                              • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                              • #initialize JavaScript engine
                                                                                                                              • Set Variable [ $JS; Value:MBS( "JS.New" ) ]
                                                                                                                              • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                              • Set Variable [ $r; Value:MBS( "JS.SetGlobalPropertyValue"; $JS; "InputValue"; $Input) ]
                                                                                                                              • #Run Sort 10 times, so we can get a better average time
                                                                                                                              • Set Variable [ $count; Value:Sort Benchmark::Rounds ]
                                                                                                                              • Set Variable [ $index; Value:1 ]
                                                                                                                              • If [ $index ≤ $count ]
                                                                                                                              • Loop
                                                                                                                              • #your script steps here
                                                                                                                              • Set Variable [ $r; Value:MBS( "JS.Evaluate"; $JS; "CR = String.fromCharCode(13); list = InputValue.split(CR); list.sort(); OutputValue = list.join(CR);" ) ]
                                                                                                                              • #next
                                                                                                                              • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                              • Exit Loop If [ $index > $count ]
                                                                                                                              • End Loop
                                                                                                                              • End If
                                                                                                                              • #get result and free engine
                                                                                                                              • Set Variable [ $Sort; Value:MBS( "JS.GetGlobalPropertyValue"; $JS; "OutputValue" ) ]
                                                                                                                              • Set Variable [ $r; Value:MBS( "JS.Free"; $JS ) ]
                                                                                                                              • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                              • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                              • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) / $count ]
                                                                                                                              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: [Sort with MBS JavaScript]Next Script: [-]
                                                                                                                                      Script NameSort with MBS Webviewer
                                                                                                                                      Run script with full access privilegesOff
                                                                                                                                      Include In MenuYes
                                                                                                                                      Layouts that use this script
                                                                                                                                      Scripts that use this script
                                                                                                                                        Script Definition
                                                                                                                                        Script Steps
                                                                                                                                        • #Sort via MBS Plugin and JavaScript engine
                                                                                                                                        • Set Field [ Sort Benchmark::Output; "" ]
                                                                                                                                        • Set Variable [ $StartTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                                        • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                                        • #Run Sort 10 times, so we can get a better average time
                                                                                                                                        • Set Variable [ $count; Value:Sort Benchmark::Rounds ]
                                                                                                                                        • Set Variable [ $index; Value:1 ]
                                                                                                                                        • If [ $index ≤ $count ]
                                                                                                                                        • Loop
                                                                                                                                        • #your script steps here
                                                                                                                                        • Set Variable [ $InputValues; Value:Substitute(Substitute ($Input; "'"; "\'"); ¶; "\r") ]
                                                                                                                                        • Set Variable [ $sort; Value:MBS( "WebView.Evaluate"; "web"; "InputValue = '" & $InputValues & "'; CR = String.fromCharCode(13); list = InputValue.split(CR); list.sort(); OutputValue = list.join(CR);" ) ]
                                                                                                                                        • #next
                                                                                                                                        • Set Variable [ $index; Value:$index + 1 ]
                                                                                                                                        • Exit Loop If [ $index > $count ]
                                                                                                                                        • End Loop
                                                                                                                                        • End If
                                                                                                                                        • Set Variable [ $EndTime; Value:Get ( CurrentTimeUTCMilliseconds ) ]
                                                                                                                                        • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                                        • Set Field [ Sort Benchmark::Time; ($EndTime - $StartTime) / $count ]
                                                                                                                                        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: [Sort with MBS Webviewer]Next Script: [Sort in FileMaker 2]
                                                                                                                                                Script Name-
                                                                                                                                                Run script with full access privilegesOff
                                                                                                                                                Include In MenuYes
                                                                                                                                                Layouts that use this script
                                                                                                                                                  Scripts that use this script
                                                                                                                                                    Script Definition
                                                                                                                                                    Script Steps
                                                                                                                                                      Fields used in this script
                                                                                                                                                        Scripts used in this script
                                                                                                                                                          Layouts used in this script
                                                                                                                                                            Tables used in this script
                                                                                                                                                              Table occurrences used by this script
                                                                                                                                                                Custom Functions used by this script
                                                                                                                                                                  Custom menu set used by this script

                                                                                                                                                                    Previous Script: [-]Next Script: [Sort with MBS List 2]
                                                                                                                                                                    Script NameSort in FileMaker 2
                                                                                                                                                                    Run script with full access privilegesOff
                                                                                                                                                                    Include In MenuYes
                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                        Script Definition
                                                                                                                                                                        Script Steps
                                                                                                                                                                        • #Sort using FileMaker's sort function
                                                                                                                                                                        • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                                                                        • Set Variable [ $Sort; Value:SortValues ( $Input ) ]
                                                                                                                                                                        • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                                                                        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: [Sort in FileMaker 2]Next Script: [Sort with MBS JavaScript 2]
                                                                                                                                                                                Script NameSort with MBS List 2
                                                                                                                                                                                Run script with full access privilegesOff
                                                                                                                                                                                Include In MenuYes
                                                                                                                                                                                Layouts that use this script
                                                                                                                                                                                  Scripts that use this script
                                                                                                                                                                                    Script Definition
                                                                                                                                                                                    Script Steps
                                                                                                                                                                                    • #Sort via List functions in MBS Plugin
                                                                                                                                                                                    • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                                                                                    • Set Variable [ $Sort; Value:MBS( "List.Sort"; $Input) ]
                                                                                                                                                                                    • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                                                                                    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: [Sort with MBS List 2]Next Script: [Sort with MBS Webviewer 2]
                                                                                                                                                                                            Script NameSort with MBS JavaScript 2
                                                                                                                                                                                            Run script with full access privilegesOff
                                                                                                                                                                                            Include In MenuYes
                                                                                                                                                                                            Layouts that use this script
                                                                                                                                                                                              Scripts that use this script
                                                                                                                                                                                                Script Definition
                                                                                                                                                                                                Script Steps
                                                                                                                                                                                                • #Sort via MBS Plugin and JavaScript engine
                                                                                                                                                                                                • #initialize JavaScript engine
                                                                                                                                                                                                • Set Variable [ $JS; Value:MBS( "JS.New" ) ]
                                                                                                                                                                                                • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                                                                                                • Set Variable [ $r; Value:MBS( "JS.SetGlobalPropertyValue"; $JS; "InputValue"; $Input) ]
                                                                                                                                                                                                • Set Variable [ $r; Value:MBS( "JS.Evaluate"; $JS; "CR = String.fromCharCode(13); list = InputValue.split(CR); list.sort(); OutputValue = list.join(CR);" ) ]
                                                                                                                                                                                                • #get result and free engine
                                                                                                                                                                                                • Set Variable [ $Sort; Value:MBS( "JS.GetGlobalPropertyValue"; $JS; "OutputValue" ) ]
                                                                                                                                                                                                • Set Variable [ $r; Value:MBS( "JS.Free"; $JS ) ]
                                                                                                                                                                                                • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                                                                                                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: [Sort with MBS JavaScript 2]
                                                                                                                                                                                                        Script NameSort with MBS Webviewer 2
                                                                                                                                                                                                        Run script with full access privilegesOff
                                                                                                                                                                                                        Include In MenuYes
                                                                                                                                                                                                        Layouts that use this script
                                                                                                                                                                                                          Scripts that use this script
                                                                                                                                                                                                            Script Definition
                                                                                                                                                                                                            Script Steps
                                                                                                                                                                                                            • #Sort via MBS Plugin and JavaScript engine
                                                                                                                                                                                                            • Set Variable [ $Input; Value:Sort Benchmark::Input ]
                                                                                                                                                                                                            • Set Variable [ $InputValues; Value:Substitute(Substitute ($Input; "'"; "\'"); ¶; "\r") ]
                                                                                                                                                                                                            • Set Variable [ $sort; Value:MBS( "WebView.Evaluate"; "web"; "InputValue = '" & $InputValues & "'; CR = String.fromCharCode(13); list = InputValue.split(CR); list.sort(); OutputValue = list.join(CR);" ) ]
                                                                                                                                                                                                            • Set Field [ Sort Benchmark::Output; $sort ]
                                                                                                                                                                                                            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

                                                                                                                                                                                                                    Custom Functions

                                                                                                                                                                                                                    Function NameParametersAvailabilityDefinitionIn Field DefinitionsIn Scripts
                                                                                                                                                                                                                    ValuesLessThanOrEqualvalues;referenceAll accounts/*ValuesLessThanOrEqual( list; reference) returns all values in list that are less than or equal to reference*/ // from https://www.briandunning.com/cf/86 Let( listLength = ValueCount( values); Case( //if the first element is less than or equal to reference... LeftValues( values; 1) <= reference; //return the first element LeftValues( values; 1) ) & Case( //if list is not trivial [there's more than one element] listLength > 1; //return all other elements less than reference ValuesLessThanOrEqual( RightValues( values; listLength - 1); reference ) ) ) //end Let()
                                                                                                                                                                                                                      ValuesGreaterThanlistvalues;referenceAll accounts/* ValuesGreaterThan( listvalues; reference) Theo Gantos - TEKA, Inc. - www.tekainc.com Returns all values in list that are greater than the reference parameter Originally written by Jeremy Bante, OshVay Systems, Inc., but was lost, so I rewrote it Original function used the parameter List, which is now a reserved word, changed to listvalues. Used by QuickSort(listvalues), also written by Jeremy */ // from https://www.briandunning.com/cf/640 Let( listLength = ValueCount( listvalues ); Case( //if the first element is greater than the reference... LeftValues( listvalues; 1) > reference; //return the first element LeftValues( listvalues; 1) ) & Case( //if list is not trivial [there's more than one element] listLength > 1; //return all other elements greater than reference ValuesGreaterThan( RightValues( listvalues; listLength - 1); reference ) ) ) //end Let()
                                                                                                                                                                                                                        QuickSortvaluesAll accounts/*QuickSort( list ) sorts list with the popular and reasonably efficient quicksort algorithm It requires the ValuesLessThanOrEqual( list ; reference ) and ValuesGreaterThan( list ; reference ) functions.*/ // from https://www.briandunning.com/cf/89 Let( [ listLength = ValueCount( values); pivotIndex = Ceiling( Random * listLength); pivot = MiddleValues( values; pivotIndex; 1); listLessPivot = LeftValues( values; pivotIndex -1) & RightValues( values; listLength - pivotIndex) ]; Case( //if list is trivial [only one element]... listLength < 2; //return list as-is values; //if list is worth sorting... QuickSort( ValuesLessThanOrEqual( listLessPivot; pivot)) & //sort everything less than or equal to pivot pivot & //place pivot in middle QuickSort( ValuesGreaterThan( listLessPivot; pivot)) //sort everything greater than pivot ) //end Case() ) //end Let()

                                                                                                                                                                                                                          Custom Menu Sets

                                                                                                                                                                                                                          Menu SetsMenusIn ScriptsIn LayoutsComments
                                                                                                                                                                                                                          [Standard FileMaker Menus]
                                                                                                                                                                                                                          • All Standard Menus

                                                                                                                                                                                                                          Download example: Sort Benchmark

                                                                                                                                                                                                                          Used functions:




                                                                                                                                                                                                                          Links
                                                                                                                                                                                                                          MBS Xojo Chart Plugins