question

Mike avatar image
0 Likes"
Mike asked Jason Lightfoot edited

How to import data from global table to empirical distribution table

Hi,

I would like to connect to SQL server from the production line to pull the past one month uptime and downtime data of the machine. Upon accessing SQL server, it looks like data will be imported to global table. Then, how to import the data from global table to Empirical table automatically. That means once the model starts running, model connect to SQL sever and retrieve data then data will be imported to global table then empirical table. Would that be possible? if yes, appreciate if you could help to make a simple example model. Thanks a lot.

1692319220099.png


FlexSim 23.2.0
global tableimportempirical distribution
1692319220099.png (94.4 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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jason Lightfoot edited

You can use the code below to copy the table into the distribution. Just replace the distribution and table names so they match your model.

treenode distributionTable = Model.find("/Tools/EmpiricalDistributions/TestName>variables/data");
Table("TestTable").cloneTo(distributionTable.as(Table));
· 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.

Mike avatar image Mike commented ·

Where should this code be written? Global table>>on reset>> script edit? Thanks.

1692346707859.png

0 Likes 0 ·
1692346707859.png (56.9 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦ Mike commented ·

How often do you need it updated? If it's once then just put it in the script console and run it from there.

0 Likes 0 ·
Mike avatar image Mike Jason Lightfoot ♦ commented ·
I want to update every time the model runs.
0 Likes 0 ·
Show more comments