question

Tom S4 avatar image
0 Likes"
Tom S4 asked Tom S4 commented

Dynamically disable/enable processflow sources

I have a model with a lot of ProcesFlow sources that I would like to enable and disable more easily. I am using a table which, on reset, will dynamically add all sources (if it finds "Source" in the activity's classes), remove any null values (if the source no longer exists), and syncs up the sources "enabled" variable to a value from the table (for example, setvarnum(activity, "enabled", 1)).

The reset trigger is functioning mostly as intended, and I can easily control the state of each source. The one thing it is not doing is updating the icon to show as disabled. See below for an example.

1648655643198.png


1648655695504.png


Is there a way to automatically update the icon when I disable/enable a source? Similar to how it updates when enabling/disabling manually.

As a side question, is there a way to view/record what commands are being triggered when certain actions are performed? I'm envisioning something similar to how Excel has an ability to record macros. It looks like the event log only captures events triggered within the model run.

Thank you.

FlexSim 21.1.5
global tableprocessflow sourcetree variable
1648655643198.png (17.3 KiB)
1648655695504.png (23.2 KiB)
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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Tom S4 commented

You need to call the source's updateIcon function:

function_s(source, "updateIcon");

See How can I change the visual of a source by FlexScript?

If you use a parameter to enable/disable the source activities it automatically handles updating the icon:

1648658665527.png


1648658665527.png (38.2 KiB)
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
We don't have a record macro ability, but you can view the structure of open views by right clicking on the view and selecting View - > Explore Structure. This is pretty advanced and probably not super helpful, but doing so will let you see that the Enabled checkbox has an OnPress node that calls the updateIcon function.
0 Likes 0 ·
Tom S4 avatar image Tom S4 Matthew Gillespie ♦♦ commented ·
Thanks for your help, and thank you for linking the previous question - I did not find that in my search.

The Explore Structure tip also seems like a helpful starting point in lieu of the ability to record commands.

0 Likes 0 ·