USER_PREFERENCE_SET ()
USER_PREFERENCE_SET(PREFERENCE, [VALUE], [SCOPE]) |
Changes the value of a preference assigned to a USER. If the preference did not exist, then a new one will be created
You can retrieve the value of a preference by means of the FORMULA USER_PREFERENCE_GET ()
Input Parameters
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
PREFERENCE |
| Yes | Name of the preference | |
VALUE |
| No | New value assigned to the preference. If empty, the preference will be deleted | |
SCOPE | “PROGRAM” | No | Defines the scope for which the preference was defined. See PREFERENCE SCOPE |
Execution
Always. Calculated on-the-fly whenever an ITEM of a FORM is changed (by means of form_set_answer(), or when the FORM is opened
Examples
Formula | Description |
---|---|
USER_PREFERENCE_SET(“SHOW_HELP”, “0”) | Assign the value “0” to the preference named “SHOW_HELP” in the context of the PROGRAM where the FORMULA is executed |
USER_PREFERENCE_SET(“SHOW_HELP”, “USER”) | Assign the value “0” to the preference named “SHOW_HELP” as a global setting of the USER |
PREFERENCE SCOPE
Preferences are defined in a specific scope. Currently the accepted scopes are:
“PROGRAM” (default value): The preference is valid only in the context of the PROGRAM where the FORMULA is executed
“USER”: Global preference of the USER
For example, when the scope of the preference is set to “PROGRAM”, it means that if you have 2 different PROGRAMS that refer to the same preference name, the value returned will be different depending on the context where the FORMULA is executed.