AX1592
SetSharedVariable function
Sets the value of a named shared variable, and returns the variable value into the cell.
This function is only for use in composite Axiom form configurations, where there is a parent form with one or more child forms displayed using the Embedded Form component. Shared variables provide a way to pass information between the parent form and the child forms.
Syntax
SetSharedVariable("VariableName", "Value")
Parameter | Description |
---|---|
VariableName |
The name of a particular shared variable for which you want to set the value. |
Value |
The value to be used for the shared variable. Whenever the SetSharedVariable function is evaluated, the value specified in the Value parameter is set as the variable value, overwriting any existing value for the variable. |
All non-numeric entries must be placed in double quotation marks, unless you are using cell references to reference the text held in another cell.
Shared variable values
(missing or bad snippet)Variable values can be set within the parent form or within any embedded child form. Once the variable value is set, it is then available to all forms within the shared form context, though the form must be updated in order to reflect a changed variable value.
Remarks
Only one form in the shared form instance should contain a SetSharedVariable function for a given variable name. For example, the parent form can contain a SetSharedVariable function and the child forms can contain a GetSharedVariable function, or vice versa. If more than one form contains a SetSharedVariable function for the same variable name, then the variable value will not be shared between those forms because each form will set its own value as it is updated (and from the user perspective, the last form updated will win).
- (missing or bad snippet)
SetSharedVariable is a volatile function.
Examples
=SetSharedVariable("PlanCode","42000")
This example sets the value of the shared variable PlanCode to 42000 (and the function also returns this value). In real-life use cases, the value 42000 would most likely be returned using a data lookup query, and then that return cell would be referenced in the function, such as: =SetSharedVariable("PlanCode",Variables!D24)
This example would be used in the parent form to identify the current plan code for the shared form context. The child forms displayed in the Embedded Form component would then use the GetSharedVariable function to reference this value.