Idea

Mischa Spelt avatar image
7 Likes"
Mischa Spelt suggested Jordan Johnson commented

Set Global Variable from Parameter Table

Currently parameter tables do not support Global Variables. Even the pass-through solution in 21.2 doesn't work, because it sets the 'Data' node as a number but it should be a string. The best solution I've found is to use the standard "Set Node Value" template for the On Set field and manually change

reference.value = newValue;

to

reference.value = string.fromNum(newValue);

Of course, I still have to find the path to "MODEL:/Tools/GlobalVariables/MyGlobalVariable/Data" and paste that into the Reference field.

global variablesmodel parameters table
5 |100000

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

2 Comments

·
Lars Christian J2 avatar image
1 Like"
Lars Christian J2 commented

A option could be to allow any variable anywhere in a model, to be marked as a parameter and if so marked, show it in the parameter section of the toolbox. That will solve this problem and also that it is not possible to have several parameter tables with identical field names.

5 |100000

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

Jordan Johnson avatar image
0 Likes"
Jordan Johnson commented

Model Parameters are globally accessible, so I suspect new models will simply use them instead of Global Variables.

Existing models attempting to upgrade so that global variables use parameter values would add an OnReset trigger to the model, and apply the value here, instead of in the OnSet trigger of the parameter itself:

MyGlobalVar = Model.parameters.Parameter1;

Parameter values are set before the Model's OnReset fires, so this method applies the value.

I would be interested to discuss further, if these two ideas don't resolve your concerns.

5 |100000

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

Write a Comment

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

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.