question

Jarek O avatar image
0 Likes"
Jarek O asked Jarek O commented

How to re-import table from excel on reset?

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

Choose One
excel import
5 |100000

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

1 Answer

Steven Hamoen avatar image
3 Likes"
Steven Hamoen answered Jarek O commented

@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)

· 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.

Jarek O avatar image Jarek O commented ·

Thanks, I will clone the table.

0 Likes 0 ·