How to import data from a SQL server in real time ?

How to import data from a SQL server in real time ?

muhamed_gabeljic
Explorer Explorer
165 Views
13 Replies
Message 1 of 14

How to import data from a SQL server in real time ?

muhamed_gabeljic
Explorer
Explorer

[ FlexSim 21.0.10 ]

Hello,

I am trying to import in real time data from a SQL database.

I can import manually but I can't find anything on how to import in real time the data.

Any help would be appreciated.

Thank you in advance !

0 Likes
166 Views
13 Replies
Replies (13)
Message 2 of 14

Jeanette_Fullmer
Community Manager
Community Manager

Hi @Mumo,

Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes
Message 3 of 14

Tim31
Not applicable

Hello, I would like to know is there a solution to this problem?

0 Likes
Message 4 of 14

logan_gold
Community Manager
Community Manager

@Tim, here's how to set up a database connection. Normally, you would import data once before running the model and can use the "Import Automatically On Reset" option to automatically import every time the model is reset.

If you want to have the data imported as needed during the model run, you will need to use the FlexScript functions at the bottom of the page and call them when you want to import data during the model run. This can slow down the model run significantly, though, depending on how often calls are made to the database and how big the database is.

0 Likes
Message 5 of 14

Tim31
Not applicable


@Logan Gold ,Thank you, Logan Gold. I saw the user manual today about linking to the database, and I tried it. But I would like to know that in practical use, if I want data to be imported and exported from SQL in real time, I can't always refresh the data through the "import" and "export" buttons. It makes the experience very poor. I wonder if I can achieve my idea in some way?

0 Likes
Message 6 of 14

logan_gold
Community Manager
Community Manager
You will need to use the FlexScript database commands to do what you want to do.
0 Likes
Message 7 of 14

Tim31
Not applicable

I checked the user manual. Maybe it's my understanding, I didn't find the command to update the data. What you're trying to say is that I can click this button with the flexcript command? And put this command into any entity's drawing trigger to update the data?

0 Likes
Message 8 of 14

Tim31
Not applicable

@Logan Gold Sorry, I can't find the right command, can you help me? I want to be able to export data in real time from a database connection.

0 Likes
Message 9 of 14

joerg_vogel_HsH
Mentor
Mentor
@Tim, hmm, there is the command reference. There is a search tool within. or you can open a search mask by key combination of ctrl and f, where f stands for find. A command for a database gets typically a prefix of "db". So if you would simply use methods, programmers did in the past, you may find an answer for yourself.
0 Likes
Message 10 of 14

Tim31
Not applicable

Thanks. I'll give it a try

0 Likes
Message 11 of 14

Tim31
Not applicable

@Joerg Vogel I see two commands, "dbexportnode" and "dbexporttable," and I try to add a command to the user event that refreshes every second, but I can't find the right way to use this command. I will attach my model for reference.ddddd.fsm

0 Likes
Message 12 of 14

joerg_vogel_HsH
Mentor
Mentor
@Tim, now your question is different to your question here. Please ask a new question about using this command in your context correctly.
0 Likes
Message 13 of 14

Tim31
Not applicable

I'm sorry. Maybe that was a mistake. I would like to use your prompt to refresh the data exported to the database with the command "db". So I used "dbexportnode" and "dbexporttable." Is there any other way?

0 Likes
Message 14 of 14

jason_lightfootVL7B4
Autodesk
Autodesk
Take a look at Prepared statements.