question

Enrique Elizaga avatar image
0 Likes"
Enrique Elizaga asked Manuel Sinco commented

create a Global Table in flexscript

Is it possible to create new tables inside part of a code. Then to destroy in another code. The number of tables created will depend on an integer in a label called "DAYS TO RUN". I want to have data per day on each table. I tried insertcopy but didn't work.

FlexSim 18.2.2
global tableflexscript
5 |100000

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

Steven Hamoen avatar image
1 Like"
Steven Hamoen answered Manuel Sinco commented

@Enrique Elizaga If I want to do something like this I look through the tree to find how FlexSim did it. In this case there is actually an application command for it:

treenode table = applicationcommand("addglobaltable");
· 3
5 |100000

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

Enrique Elizaga avatar image Enrique Elizaga commented ·

Great @steven.hamoen, it worked! Can you give me more detail on "looking through the tree". This will give me lots of options. For example, when the table is created it opens it up on a new window. How can i close that window through flexscript...

0 Likes 0 ·
Steven Hamoen avatar image Steven Hamoen Enrique Elizaga commented ·

@Enrique Elizaga

If you open the view tree you can search through the tree in the search box in the quick properties. So I looked for Toolbox and drilled down till I found the table add option

1 Like 1 ·
Manuel Sinco avatar image Manuel Sinco Steven Hamoen commented ·

Hi @steven.hamoen,

I searched in the same way as you suggested through the view tree, but I was not able to find which the command closes the window of the new table, can you add it, please?

Thanks.

Manuel.

0 Likes 0 ·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Enrique Elizaga commented

Try this

treenode globalTablesNode = model().find("Tools/GlobalTables");
treenode newTable = createcopy(globalTablesNode.first,globalTablesNode,0);
newTable.name = "myNewTable";

It copies the first global table of the global tables.

If you know the name of the table for example "MyKnownTableName"

globalTablesNode.subnodes["MyKnownTableName"] 

is the reference to this table object.

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

Alfredo DF2 avatar image Alfredo DF2 commented ·

After entering the table, how do I assign the dimensions by flexscript?

0 Likes 0 ·
Enrique Elizaga avatar image Enrique Elizaga Alfredo DF2 commented ·

Hi, do you mean the table size? Doing this.

MyKnownTableName.setSize(5,5);

Or whatever size you want.

0 Likes 0 ·
Alfredo DF2 avatar image Alfredo DF2 Enrique Elizaga commented ·

capture.png

I cannot do it. This is my script, I want to inser by flexscript a table 38x6, but the software don't read the comand.

0 Likes 0 ·
capture.png (4.8 KiB)
Show more comments