fm_set_variable
mixed fm_set_variable ( string $name
, string $value
)
Description
Allows you to store variables which can then be retrieved using fm_get_variable or fm_get_defined_variables.
These variables are different from FileMaker variables in that they are stored at the application level, meaning they can be accessed from any open FileMaker database.
Once a variable is set, it will persist in memory until:
- You delete it using fm_unset.
- You quit FileMaker.
- You stop the plug-in by un-checking it in the preferences.
Note that you can store hidden variables by prefixing the variable name with double underscores “__”. These variables will not be returned by fm_get_defined_variables and thus are considered “hidden”.
The following PHP types can be stored: bool, int, double, string, array. Boolean values will be stored as 1 or 0 and returned as integers.
Parameters
name
(required)
The name of the variable to set.
value
(required)
The value to set.
Return
Returns the value
that was set.
Errors
echo fm_set_variable('foo', 'bar'); /* Returns: bar */
$fb = array( 'foo' => 'bar', 'bar' => 'foo' ); fm_set_variable('fb', $fb); print_r(fm_get_variable('fb')); /* Returns: Array ( [foo] => bar [bar] => foo ) */
Change Log
Version | Description |
---|---|
3.0.0 | Added support for storing bool, int, double and array values. |