question

Abhishek K avatar image
0 Likes"
Abhishek K asked Abhishek K commented

How to export HTML on Model Stop?

I am trying to export HTML dashboard on model stop.

When I export it as csv using the code below, it works fine


string curDir = modeldir();

treenode obj = model().find("Tools/Statistics/State Bar"); function_s(obj,"createCSV",curDir+"Dummyresult.csv");

I am unable to find the string that needs to be used in function_s that does the export in HTML format.

Intuitively, I tried "createHTML" , but that does not seem to work.

FlexSim 18.1.1
exporthtmldashboard export
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

Jordan Johnson avatar image
5 Likes"
Jordan Johnson answered Abhishek K commented

First of all, I would not put export code in the OnModelStop trigger. Does your model have a Stop Time? You could put a user event at that stop time to export the code. That way, as you debug your model, you won't export many useless charts.

Second, a chart doesn't know how to export a complete HTML page. It only knows how to export components, like the bundle data and which js scripts it needs. These four functions all start with getOffline, and are found in MAIN:/project/library/statistics/StatisticObject>behaviour/eventfunctions. You could try calling all four functions (using function_s(obj, "getOffline*")) to see what you get, and then write code that generates html manually.

Another option would be to do what the view does. This requires calling functions on the view, not on the statistics objects:

  1. treenode anActiveDashboard = ownerobject(views().find("active>Documents/Dashboard/1+"));
  2.  
  3. // the following function is defined in VIEW:/standardviews/statistics/Dashboard>eventfunctions/saveHTML.
  4. // If you don't like the behavior defined here, you could still use the code there to get you started
  5. function_s(anActiveDashboard, "saveHTML", 1);
  6.  
  7.  
· 3
5 |100000

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