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

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

ahmed_azab
Not applicable
12 Views
2 Replies
Message 1 of 3

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

ahmed_azab
Not applicable

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);
0 Likes
Accepted solutions (1)
13 Views
2 Replies
Replies (2)
Message 2 of 3

sam_stubbsYXX86
Community Manager
Community Manager

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
Message 3 of 3

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

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.