Literal object syntax: { "Name": "Value" ; ... } - e.g. for multiple parameter passing

Idea created by mrwatson-gbs on Apr 5, 2016

    This idea builds on the idea of having a New Data Type for Variables: 'Object' (=Associative array).




    If FileMaker develop a new Object data type for variables, this would make it possible to perform Native Multiple Parameter Passing easily - and without any change to the parameter passing mechanism!


    Moreover, if fileMaker supported a literal object syntax, multiple parameters could be passed extremely elegantly and efficiently:


    For example:


    Perform Script[ "MyScript" ; Parameter: { "Type": "FMP" ; "Quantity": 7 ; "Date": GetAsDate( Get( CurrentHostTimestamp ) ) } ]

    If [ $error ]

    Set LastError [ $error ]

    Exit Script [ { "Success": false ; "Result" : $errMsg} ]

    End If

    Exit Script [ { "Success": true ; "Result" : $result } ]


    As you can see, such a literal syntax is extremely compact and easy to read.


    My recommendation for a literal object syntax would be that the name part be a normal quoted string and the value any FileMaker data type.


    - This makes it possible to construct objects with dynamic names

    - Such a literal syntax would also introduce no new syntactic elements to be parsed (e.g. no label) - other than the {:;} punctuation.


    Of course, values may also be literal  objects, thus we could have hierarchical objects:


    Exit Script [ { "Success": true ; "ResultObject" : { "Result1": 17 ; "Result2": "A" } } ]




    Similarly, if FileMaker develop native support for JSON, such a literal object syntax could act as a very efficient method of converting data to a JSON string, for example:


    # Save JSON string representation of the object

    Set Field[ Export::JSON ; GetAsJSON( { "Options": "A¶B¶C" ; "Pi": 3.1415926 ; "Ref": Related::RefNr ) ) } ) ]


    # Export Field



    Converting from a JSON string, is not the focus of this idea, but might look something like this:


    # Get JSON String

    Insert from URL[ Import::JSON ; $WebserviceURL ]


    # Convert JSON String to object variable

    Set Variable [ $ImportObject[*] ; GetAsObject( Import::JSON ) ]


    # Extract separate object properties

    Set Field [ TargetTable::Size ; $ImportObject["Size"] ]

    Set Field [ TargetTable::Qty ; $ImportObject["Quantity"] ]






    • Extremely simple method of encoding passing multiple parameters
    • Easy to read and understand
    • This method could/would become the standard method of passing multiple parameters => Interchangeability of code
    • Really easy-to-implement / simple solution to the multiple parameter passing idea


    Use Cases


    • Passing multiple ScriptParameters
    • Returning multiple ScriptResults
    • Converting data efficiently to JSON
    • Can be used to reduce the number of variables in the data viewer
    • Simplify code by packing previously separated variables into a single object
    • Data processing of complex objects