How to re-import table from excel on reset?

How to re-import table from excel on reset?

jarek_o
Not applicable
320 Views
2 Replies
Message 1 of 3

How to re-import table from excel on reset?

jarek_o
Not applicable

I have a 'parameter' global table that has to be updated during runtime. But when I reset my model the numbers have to go back to default. Is there an elegant way to do this (not with on reset triggers and stuff...) Thanks

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

SCHamoen
Advisor
Advisor
Accepted solution

@Jarek O If you excel changes there is a checkbox you can use on Excel Import gui, but that is a bit slow and if your excel hasn't change this doesn't work. The simplest solution in my opinion would be to have the same excel file read in to 2 tables and in the onReset triggers simply copy one table to the other. The code is very simple:

Table table1 = reftable("GlobalTable1");
Table table2 = reftable("GlobalTable2");
table1.cloneTo(table2);

A second option would be to use the excelimporttable command in the onreset trigger.

( you said you didn't want to use the reset trigger but I don't see any other way of doing it without writing any code)

Message 3 of 3

jarek_o
Not applicable

Thanks, I will clone the table.

0 Likes