question

Jun Woo K avatar image
0 Likes"
Jun Woo K asked Jun Woo K commented

Modification of global table by using model reset trigger

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?

FlexSim 18.1.2
model triggers
· 1
5 |100000

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

Jun Woo K avatar image Jun Woo K commented ·

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 0 ·
Allister Wilson avatar image
2 Likes"
Allister Wilson answered Allister Wilson edited

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.


5 |100000

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

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

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
5 |100000

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