question

Jarek O avatar image
0 Likes"
Jarek O asked Arun Kr edited

Global variable Array with Array elements

Hi,

I would like to make an Global Variable with type Array, containing Arrays as elements.

example:

Array[2]: Array("foo",1), Array("foo",2);

It doesn't seem to be that easy for me.

Flexsim version: 17.1.6

Choose One
global variables
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

·
Arun Kr avatar image
0 Likes"
Arun Kr answered Arun Kr edited

Hi @Jarek O,

Here's a simple example.

First you create a global array variable manually, then you can insert array elements through code.

int rows = 5;
Array DataArray = [5,3,2];
Array array = Array(rows);
array.fill(DataArray);
GlobalArray = array;// GlobalArray is the global array variable

Regards,

Arun KR

· 4
5 |100000

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

Jarek O avatar image Jarek O commented ·

Is this working for you? For me it doesn't work, I tried similar things as well, but nothing that succeeds.

Regards,

Jarek

0 Likes 0 ·
Arun Kr avatar image Arun Kr Jarek O commented ·

yes, just see the return value on the script console.global-array.fsm

0 Likes 0 ·
global-array.fsm (13.1 KiB)
global-array.png (20.4 KiB)
Jarek O avatar image Jarek O Arun Kr commented ·

yes @Arun KR, but it isn't stored in the GV? If you run that script, it returns indeed that array, but the global variable itself is still empty in further use.

Jarek

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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