Set variable to dynamic panel state

I have a dynamic panel with two different states (=> custom checkbox). The states of the panel are called “activated” and “deactivated”. When a “save” button (hotpsot) is clicked, I want to set the value of a variable “v1” to the name of the state of the dynamic panel which is active (=> “activated” or “deactivated”).

So far I have only been able to achieve this via different cases with if conditions. However, I have a lot of these checkboxes and would like to make this workflow more efficient.

Advice is very much appreciated.

You can use the OnPanelStateChange event for the dynamic panel and a case action of Set value of v1 equal to state of This. If you need to change the “v1” value only when the Save button is clicked, then just use similar action for its OnClick: Set value of v1 equal to state of MyDynamicPanel.

Is there any way to access the state as a parameter, for example:

[[this.state]]

This would be very helpful in cases where a state change in one panel should be reflected in more panels.

There is not a built-in parameter/variable for .state, but you can conditionally test states with the “state of panel” option, pointing to either “This” or any available dynamic panel:

You can also set dynamic panel states based on their name or number (position in the stack of states), as in, “Set (Dynamic Panel) to [[LVAR1.text]]” --as long as, in this example, the text on the widget pointed to by LVAR1 exactly matches the name of a state in the dynamic panel.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.