Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JS.SetGlobalProperty
Sets a global property.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JavaScript | 10.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
JSRef | The JavaScript reference number. | $js |
Name | The name of the variable. | "test" |
Value | The JSON value. | "[1,2,3]" |
Result
Returns OK or error.
Description
Sets a global property.Please pass value as JSON value.
Examples
Get and set some properties:
Set Variable [ $js ; Value: MBS( "JS.New" ) ]
# try number
Set Variable [ $r ; Value: MBS( "JS.SetGlobalProperty"; $JS; "v1"; 123 ) ]
Set Variable [ $v1 ; Value: MBS( "JS.GetGlobalProperty"; $JS; "v1") ]
# try some JSON array
Set Variable [ $r ; Value: MBS( "JS.SetGlobalProperty"; $JS; "v2"; "[1,2,3]" ) ]
Set Variable [ $v2 ; Value: MBS( "JS.GetGlobalProperty"; $JS; "v2") ]
# try some text
Set Variable [ $r ; Value: MBS( "JS.SetGlobalProperty"; $JS; "v3"; "\"test\"" ) ]
Set Variable [ $v3 ; Value: MBS( "JS.GetGlobalProperty"; $JS; "v3") ]
# show results
Show Custom Dialog [ "Property" ; $v1 & ¶ & $v2 & ¶ & $v3 ]
Set Variable [ $r ; Value: MBS( "JS.Release"; $JS ) ]
See also
Release notes
- Version 11.3
- Changed JS.CallFunction and JS.SetGlobalProperty to not return an error for invalid JSON, but just take it as text for your convenience.
Example Databases
Blog Entries
- Custom Functions in JavaScript
- MBS FileMaker Plugin, version 11.3pr2
- New in the MBS FileMaker Plugin 10.0
- Our JavaScript engine for FileMaker
FileMaker Magazin
This function checks for a license.
Created 7th December 2019, last changed 29th October 2020