question

Jay Khedekar avatar image
0 Likes"
Jay Khedekar asked Borja Lorenzo commented

How to create a button to enable or disable certain process flow?

I want to add a button in dashboard which would enable to disable certain process flow in my model. Is it possible to do that?

FlexSim 23.0.0
process flowdashboard button
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Jonah K avatar image
1 Like"
Jonah K answered Borja Lorenzo commented

There's a couple of different ways you can accomplish this. One way that you can do it is to create a GUI button that changes the "enabled" variable in a source activity, using this code in the OnPress node (Flow1):

  1. treenode mysource1 = getactivity("ProcessFlow", "Source1");
  2. int enableval = getvarnum(mysource1, "enabled");
  3. setvarnum(mysource1, "enabled", !enableval);
  4. function_s(mysource1, "updateIcon");
  5. repaintall();

The downside is that this method requires that you reset the model each time you press the button.

If you want to be able to click the button during the model run, you could create a button which will redirect tokens to an alternate branch on a Decide activity using a Global Variable, with this code (Flow2):

  1. treenode globalvar = Model.find("Tools/GlobalVariables/Variable1");
  2. globalvar.subnodes[3].value = !globalvar.subnodes[3].value;

You can reconfigure any of these two methods to fit your needs. Here's an example model:

GUIEnableProcessFlow.fsm


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.