Modification of global table by using model reset trigger

Modification of global table by using model reset trigger

kjunwoo
Contributor Contributor
31 Views
3 Replies
Message 1 of 4

Modification of global table by using model reset trigger

kjunwoo
Contributor
Contributor

[ FlexSim 18.1.2 ]

Hi all, I have a problem with model reset trigger.

I want to insert a number of rows into a global table when model is reset,

and my scripts for this purpose is as follows:

Table wip_table = reftable("WIP");

wip_table.addRow(1);

No error message is shown when model is reset, however, it seems that this script doesn't work. (new row was not added)

Also, I fail to add new row when I modify the second line of script as follows:

wip_table.setSize(1, n); // n is number of columns

On the contrary, the above script works well when I put it into Script Window or triggers of modeling object.

Could you please help me to modify the global table by using model reset trigger?

0 Likes
Accepted solutions (1)
32 Views
3 Replies
Replies (3)
Message 2 of 4

allister_wilson
Not applicable
Accepted solution

I reproduced what you described in version 18.1.2, it seems to work as expected.
See if the attached model works on your end.

Message 3 of 4

joerg_vogel_HsH
Mentor
Mentor

You can try this on an Object reset trigger or on the OnModelReset trigger

Table("WIP").addRow(1,DATATYPE_NUMBER); // add a row before row 1
int rows = Table("WIP").numRows;// get the rows of the table
Table("WIP").setSize(rows,7,DATATYPE_NUMBER,0);// set the column count to 7
Message 4 of 4

kjunwoo
Contributor
Contributor

Thank you, Allister and Jörg.

I found that the problem was occurred by the On Reset trigger of the global table, which deletes all rows.

When I delete the trigger of global table, the script for adding row works well.

Thank you again.

0 Likes