question

Oscar Perez avatar image
0 Likes"
Oscar Perez asked Phil BoBo edited

Import Excel webserver

@phil.bobo

Phil, can you give me an example of how to import excel in webserver... In my model I have a dashboard with a press bottom that run import table, but when I try to do it on webserver this action does not work.

FlexSim 16.0.5
excel importwebserver
· 3
5 |100000

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

Phil BoBo avatar image Phil BoBo ♦♦ commented ·

Please post what you have so far, and then I can explain how to fix it.

0 Likes 0 ·
Matt Long avatar image Matt Long commented ·

Dashboard buttons are not able to be interacted with in version 16.0. You need version 16.2.

0 Likes 0 ·
Oscar Perez avatar image Oscar Perez commented ·

@phil.bobo

Philp here is my model, where I have a Dashboard with a bottom call "cargar Programa" this only run the command multitable import.

I would like to place FlexSim in a server, and the local user execute webserver and import their excel file by using webserver....

What I don't get, is here in my computer making this test what is happening is that when I ran webserver for this model, and click on this bottom what is doing is that in background FlexSim is trying to load an excel file..... my question is If I would like to put FlexSim in a server, and local user from their computer run this type of action... is that possible?

besides... once I import excel I have some post import code.. is that also taking into account in webserver?

please let me know if I'm clear, otherwise I will give you a call.

0 Likes 0 ·

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

"I would like to place FlexSim in a server, and the local user execute webserver and import their excel file by using webserver...."

FlexSim running on the server cannot access a file from the client's computer. You will need to do some web development to make it so that the client can upload the file to the server that FlexSim is running on if you want FlexSim to be able to import that file. This type of web development work is beyond the scope of technical support.

"besides... once I import excel I have some post import code.. is that also taking into account in webserver?"

Yes, FlexSim will run exactly the same on the server as it does when you run it locally. You can execute whatever code you want in FlexSim, and it will execute it. Whatever that post import code does will happen on the server though, not on the machine that is requesting an HTML response from the server.

As Matt pointed out, the default page that is returned when you connect to a FlexSim instance through the webserver has been upgraded in FlexSim 16.2.

In 16.2, it gives you back an interface that resembles the windows that are open in the model you connected to, including Dashboards and Dashboard buttons. This makes it really easy to execute FlexScript code on the webserver by simply attaching it to a button on a dashboard:

If you don't want to use that default page for interacting with a model, you can customize the defaultpage HTML that is returned by adding nodes to the Tools folder in the model tree, as explained in the User Manual section Miscellaneous Concepts > Webserver > Concepts > Developing custom web interfaces.

Attached (customwebserverexample-v16-0.fsm) is an example model built with FlexSim 16.0 that demonstrates this.

It has a custom defaultpagetemplate.

It has added two Javascript functions and two HTML buttons that execute those Javascript functions.

Extra Javascript functions have been added on lines 41-55 as an example of how to send custom queries to the server.

Lines 122-127 have added buttons and inputs for changing the arrival time and cycle time and executing the extra Javascript functions.

Those functions send queries to FlexSim that are handled by custom query handlers in the tree that execute FlexScript code.

The queryhandlers have code that set global table values. The cycle and arrival times in the model are set to read those global table values. I did this as an example; you could use whatever Flexscript code you want to modify your model in whatever way you want, such as running an Excel import.

Also, on the old forum, I posted an example php website that interacts with the FlexSim webserver instead of using the default index.html page that is served up by the flexsimserver.exe. You can download this website and see how it interacts with the FlexSim webserver through this link: https://www.flexsim.com/community/forum/showthread.php?t=2916

That's another way to write custom server-side logic, such as user authentication, file upload, etc.


1.png (535.3 KiB)
2.png (431.7 KiB)
3.png (94.4 KiB)
4.png (80.1 KiB)
5.png (79.3 KiB)
6.png (123.5 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.