Hi all,
I'd like to replicate the command Export All Dashboards to CSV using a button. How could I do it using FlexScript?
Thanks!
Hi all,
I'd like to replicate the command Export All Dashboards to CSV using a button. How could I do it using FlexScript?
Thanks!
The code for "Export All Data to CSV" uses a function_s command:
treenode focus = node("..>viewfocus+", ownerobject(c)); function_s(focus, "exportData", 1);
You could do something similar, but you need an open/active Dashboard to do it, like this:
treenode AnActiveDashboard = views().find("active>Documents/Dashboard/1+"); if (AnActiveDashboard != NULL) { function_s(ownerobject(AnActiveDashboard), "exportData", 1); }
But if you are putting this in a button on a Dashboard, that will guarantee there is an active Dashboard.
Also, since it is a function_s command, there is no guarantee it will work in future versions of the software.
You can try creating a button in Dashboard and then adding the following custom code to the "OnPress" parameter for the button.
treenode link = node("..>objectfocus+", c); /**Custom Code*/ Object current = ownerobject(c); Array tableNames; for (int i = 1; i <= Model.find("Tools/StatisticsCollectors").subnodes.length; i++){ tableNames.push(Model.find("Tools/StatisticsCollectors").subnodes[i].name); } for (int i = 1; i <= tableNames.length; i++) { string tableName = tableNames[i]; //Make sure that there is a file named "Model Run Results" within the same directory as the FlexSim Model. string fileName = modeldir() + "Model Run Results/" + tableName + ".csv"; Table.query("SELECT * FROM [" + tableName + "]").cloneTo(Table("GlobalTable1")); exporttable(Table("GlobalTable1"), fileName, 1); }
Thanks for your answers, however it would work only for Statistics Collectors and the command consider also Chart Templates.
13 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved