question

Jeremy R avatar image
0 Likes"
Jeremy R asked Jeremy R commented

Export Performance Measures Table to CSV

Is there a way to export a Performance Measures Table to a CSV? For Global Tables, Calculated Tables, and Statistics Collectors, I can use the command exporttable. However, this does not work for Performance Measures Tables.

I can export Performance Measures Tables using the Excel Export interface, but this can only write to pre-existing Excel documents. I want to be able to export the contents of my Performance Measures Table to a CSV file.

FlexSim 21.2.2
performance measuresexportcsvperformance measures table
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

Brittany Evans avatar image
0 Likes"
Brittany Evans answered Jeremy R commented

@Jeremy R ,

Since how Performance Measures are constructed a little different than traditional tables you have to do things a little differently to be able to export them using the exporttable command. I have attached a sample model that has a script in it that properly exports a Performance Measure Table.

Initially I tried to just run the exporttable command on the performanceMeasures variable node for the Performance Measure, but this only partially worked because it would export everything correctly except the value was a reference to the statistic you were interested in; not the current value. From there, a different approach was needed which ended up working. Essentially, you have to get access to the performanceMeasures variable node and run it through a query that gets dumped into a dummy node, which can then be exported using the exporttable command. (See Code Below)

  1. //Get Access to the performanceMeasures variable node for the Performance Measure you want to Export
  2. treenode export = getvarnode(Model.find("Tools/PerformanceMeasureTables/PerformanceMeasures"), "performanceMeasures");
  3.  
  4. //Create a Dummy Dump location for the data
  5. treenode dump = Model.find("Tools").subnodes.assert("dump");
  6. dump.subnodes.clear();
  7.  
  8. //Run a query that will get you the correct table with the current values that is dumped into your Dummy node
  9. Table.query("SELECT * FROM $1", export).cloneTo(Table(dump));
  10.  
  11. //Export the Dummy node information using the exporttable command
  12. exporttable(dump, "TestExport.csv", 1, 0);

Hope this helps you some.

Export Test.fsm


export-test.fsm (66.8 KiB)
· 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.