question

Fu P avatar image
0 Likes"
Fu P asked Ben Wilson commented

Use DBConnector inside GUI

I already created my own GUI page,if I want to use DBConnector to connect MySQL to import a table inside my GUI page,is this possible?If possible,how can i do it?

FYI:all my action is inside GUI.

Thank you.

FlexSim 19.2.4
flexsim 19.2.4gui
· 1
5 |100000

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

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Fu P, was jason.lightfoot's answer helpful? If so, please click the red "Accept" button on their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered CSN commented

See the database connector documentation.

You can import all data using:

treenode dbc=Model.find("/Tools/DatabaseConnectors/DBConnector1");
function_s(dbc, "importAll");

or a single import (the example show that at rank 2) using:

treenode dbc=Model.find("/Tools/DatabaseConnectors/DBConnector1");
treenode importer=dbc.find(">variables/importers/2");
function_s(dbc, "importSingle",importer);



· 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.

Fu P avatar image Fu P commented ·

Thank you and sorry for the late reply,I am new to this software and I don't really understand how to use the code you posted.

My global table and Custom GUI look like this

I want import execl and automatically replaces my global table

Can you please show me how to do it with a simple example I made?

I would appraciate it .

Thank you.

simple.fsm

1.xlsx


0 Likes 0 ·
1604837453432.png (37.3 KiB)
simple.fsm (17.3 KiB)
1.xlsx (9.9 KiB)
CSN avatar image CSN commented ·

You can add the above code where appropriate and will trigger. For example: ONPress properties of import button. This part is very detailed in the user manual.

OnPress

The OnPress event specifies code that will be executed when the button is pressed. It should have text data containing flexscript code. Within the code, c accesses the button view.

In addition, if you are the official version of 19.0 users, welcome to contact Beijing CSN for more technical Q & A and related support.

0 Likes 0 ·
1604885895519.png (59.0 KiB)

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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