question

Urvi Sukharamwala avatar image
0 Likes"
Urvi Sukharamwala asked Jason Lightfoot edited

Database - export data

1706543226974.pngI have this example model can you please help me with exporting data on run stop trigger. What should be the flexscript?

FlexSim 24.0.1
export datasql serverdatabases
1706543226974.png (79.8 KiB)
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
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

You can either trigger the export of all defined exports like this:

Object dbConnector=Model.find("Tools/DatabaseConnectors/DatabaseConnector1");
function_s(dbConnector,"exportAll");

Or trigger a single export:

Object dbConnector=Model.find("Tools/DatabaseConnectors/DatabaseConnector1");
treenode dbexport=variables(dbConnector).subnodes["exporters"].first;   // the first in the list of exports.
function_s(dbConnector,"exportSingle",dbexport); 

Since it uses function_s calls, you may need to revise this code in the future, so if you need to invoke it in many places I'd place it in a user command and call that from multiple places instead.

· 4
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 for the answer. Can you please explain how we can create subnodes (like exporters) as you mentioned for the script?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Urvi Sukharamwala commented ·
They get created by the Database Connector GUI when you set up the export. Are you saying you need to programatically add export definitions?
0 Likes 0 ·
Urvi Sukharamwala avatar image Urvi Sukharamwala Jason Lightfoot ♦ commented ·
Ok got it. Yes, if you can tell me how to do programmatically as well it would be great help
0 Likes 0 ·
Show more comments