question

Ahmed Azab avatar image
0 Likes"
Ahmed Azab asked Joerg Vogel edited

Why Global Table is cleared after each replication even when "clear on Reset" box is unchecked ?

i am collecting the the item time reaches to a queue .. and i want to record every item arrival time to this queue in a global table.. i used trigger On Entry to do this , but the global table is cleared after each replication,, the code i used as follows:

/**Custom Code*/
treenode item = parnode(1);
treenode current = ownerobject(c);
int port = parval(2);
string tablename = /**/"Terminal_Arr"/**/;


/** \nNumber of Columns: */ int columns = /**/1/**/;
/** \nColumn Format (1 = number, 2 = string): */ intarray array = makearray(columns);
fillarray(array,/**/1/**/);


if(getinput(current) == 1) { 
	settablesize(tablename,1,columns);
	for(int index=1; index<=columns; index++) { 
		nodeadddata(gettablecell(tablename,1,index),array[index]);
	}
}
else { 
	settablesize(tablename,gettablerows(tablename)+1,columns);
}

double rows = gettablerows(tablename);
/** \nCommands to set the data in the new row:*/ /**/

settablenum("Terminal_Arr",gettablerows("Terminal_Arr"),1,time);
Choose One
global tabletriggersqueues
· 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.

Sam Stubbs avatar image Sam Stubbs ♦ commented ·

Could you post an example of the model for us to look at? It's easier to troubleshoot when we can see the actual model.

Also, what version are you using?

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
1 Like"
Joerg Vogel answered Joerg Vogel edited

The source code line " if(getinput(current) == 1) " set the tablesize again to a table with only one row. That way it looks like the global table is reset, too, after reseting the model and starting the next model run.

5 |100000

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