question

Roger W avatar image
0 Likes"
Roger W asked Ben Wilson edited

syncing labels or tables with database

I would like to know if it is possible to make a global table or label display values from database without event trigger to update. basically the table or label would be in sync with the database cell and purely displays the value from the database.

Thanks

FlexSim 17.2.2
labeldatabasetablesynchronizemysql
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

Roger, please try this on your own or attach a sample model. I think, if we don't exactly know how do you update a value of a cell without an event inside from Flexsim. I can't figure out how to update a value without an event. It would be possible if the database isn't inside Flexsim. Then Flexsim must listen to this data by a sync process. The process creates events, too, iniated by time intervals or external update requests.

1 Like 1 ·
Roger W avatar image Roger W Joerg Vogel commented ·

Thank you for your quick answer
my database is an external mysql database where I can change the figures. I want the label or table in the a node to display the most updated value from the database. From your answer I am thinking the only way I can do this is to either place it in a trigger which would repeat it self to check the database or some sort of event that starts when the simulation starts. I am just curious if there are any possible way to display mysql database value in a label which updates whenever i update the database automatically

0 Likes 0 ·

1 Answer

Ben Wilson avatar image
0 Likes"
Ben Wilson answered Ben Wilson edited

@Roger W,

This answer at Stack Overflow suggests some methods that will allow you to watch for changes to a MySQL database. There are also other workarounds suggested on that page, but the basic gist is that MySQL doesn't offer an easy, out-of-the-box method for calling external functionality when changes happen in a database.

Assuming you can get one of the linked methods to work for you, such that some utility of your own making can sense when MySQL data has changed, that sensing utility could then send a message to FlexSim using sockets.

Anyway, there is no simple way to do what you'd like to do. It will take some effort.

If you switched to another database (Oracle, Microsoft, PostGreSQL, etc), there is a chance that better options might be available - though I have not researched these and don't know that for sure. Here is an example of connecting directly to Oracle using a DLL. Something like that might allow for an easier time accomplishing your goal, though I really don't know. Any solution that keeps your FlexSim data in sync with your database is going to require some research, creativity, and custom coding.

5 |100000

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