question

Cetim C avatar image
0 Likes"
Cetim C asked Jason Lightfoot edited

Continue export to an excel without overwriting

Hello,
I am carrying out an emulation process and I want to save in a excel the value that the variables have been taking over time. If I do the export every time I reset the model, the data will be overwritten, unless I tell it the row number where I want the export to start. Is there any way, from the flexsim code, to know how many rows the excel already has, and therefore, continue on the next row?

FlexSim 22.2.1
export
· 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.

Jacob W2 avatar image Jacob W2 ♦ commented ·

Hi @Cetim C, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

Try this where the row number is your excel export's rank in the list and the numrows is the number of rows you'll have exported each time.

Table exports=Model.find("Tools/ExcelAuto>variables/exporttable")
exports[1]["Start_Row"]+=numrows;
· 8
5 |100000

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

Cetim C avatar image Cetim C commented ·

Thank you for your answer, but I don´t understand you very well. Where would you put that code?

Are "Start_Row" and "numrows" variables?


I did this code in a reset model trigger but it does not work

1666347060910.png

filas is a global variable


Export.fsm

0 Likes 0 ·
1666347060910.png (4.5 KiB)
export.fsm (25.5 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Cetim C commented ·
You said you were exporting to Excel so I described how to use that tool.


If you're writing to csv files can't you just write a new file and concatenate the file using a command line operation?

0 Likes 0 ·
Cetim C avatar image Cetim C Jason Lightfoot ♦♦ commented ·

In my real model I am creating a time series and therefore I want the excel to continue on the same sheet.

I have improved the previous model (I think). I have modified the trigger on model reset and I have made the export customized, but it still does not work.

I attach it.


Export.fsm

0 Likes 0 ·
export.fsm (24.9 KiB)
Show more comments