Urvi Sukharamwala avatar image
Urvi Sukharamwala asked Jason Lightfoot commented

export dashboard data to sql server

Hello, Is it possible to export data collected/shown graphically in flexsim dashboard to SQL server? If yes, please share the steps to do that. Thank you.

I read this:

but I want steps to convert dashboard to statistics collectors as well.

FlexSim 24.0.1
dashboardsexport datasql server
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

Jason Lightfoot avatar image
Jason Lightfoot answered Jason Lightfoot commented

The steps to expose the already present stats collector from a dashboard chart are to install it.

The way to export the data to a database is to use a Database.Connector and query the (now installed) StatsCollector and use the database's INSERT INTO clause (the syntax changes depending on the specific database).

This is already described in the post to which you linked.

· 2
5 |100000

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

Urvi Sukharamwala avatar image Urvi Sukharamwala commented ·
Thank you. Can you please tell me the script for exporting the data from stats collector to database?
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Urvi Sukharamwala commented ·

It will be something like this (sqlite example):

Database.Connection con=Database.Connection("SQLiteConnection");
int connected=con.isConnected;
if (!connected)
if (connected){
    Database.PreparedStatement statement=con.prepareStatement("INSERT INTO StatsCollectorData VALUES(:Time,:Object,:Staytime)");
    Table collector = Table("Staytime Collector");
    int numrows=collector.numRows;
    for (int i = 1; i <= numrows; i++) {
        statement.bindParam("Time", collector[i]["Time"], Database.DataType.DateTime);
        statement.bindParam("Object", StatisticsCollector.getPathFromID(collector[i]["Object"]), Database.DataType.VarChar);
        statement.bindParam("Staytime", collector[i]["Staytime"], Database.DataType.Double);

if (connected)

Model and db attached:


0 Likes 0 ·