question

Lucy avatar image
0 Likes"
Lucy asked Steven Hamoen commented

How can i call a global variable depending on the type?

I have several global variables ( variable1, variable2, variable3,...) and I want to call the the variable depending on the type since there are multiple types. For example:

if type=1

Variable+type

Variable1++;

FlexSim 18.2.0
global variables
· 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.

Lucy avatar image Lucy commented ·

Using coding

1 Like 1 ·
Sebastian Hemmann avatar image Sebastian Hemmann Lucy commented ·

Can you give us some more information? Do you work in ProcessFlow or in a Trigger in the 3D Objects? Are you familiar with coding in FlexSim or better said, did you ever use a "Switch" command?

As shown in the User Manual:

2 Likes 2 ·

1 Answer

Steven Hamoen avatar image
0 Likes"
Steven Hamoen answered Steven Hamoen commented

@Lucy You could also put the global variables in an array and use the index to have access to a particular global variable

· 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.

Lucy avatar image Lucy commented ·

Hi,

I think this can work, but where do I add the array for a global variable?

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Lucy commented ·

@Lucy Just where you also create a normal global variable:

0 Likes 0 ·
globalarray.png (14.8 KiB)