question

Youichi I avatar image
0 Likes"
Youichi I asked Ben Wilson commented

How do I change the value of cell of global table in Flexsim Web server?

Hi all,

How do I change the cell value of global table in Flexsim Web server?

Is it JSON?

FlexSim 20.2.3
flexsim 20.2.3webserverpropertyjsonqueryhandler
· 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 @Youichi I, was Phil BoBo'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

Phil BoBo avatar image
0 Likes"
Phil BoBo answered Jason Lightfoot edited

Add a custom queryhandler to your model's serverinterface, as described in the Instance Queries section of https://docs.flexsim.com/en/Reference/DeveloperAdvancedUser/Webserver/#custom

From your web page, send the query with an http request. In your query handler, set the table's value.

· 9
5 |100000

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

Youichi I avatar image Youichi I commented ·

I can create instance by below command

http://127.0.0.1/webserver.dll?createinstance=tutorials\FlexSim%202020%20Update%202\Test01

I created below html. The returned value is 1. But it doesn't work.

<html>
<head>
<title>Test</title>
</head>
<body>
<form action="http://127.0.0.1/webserver.dll?submitjob" method="POST">
<input type="hidden" name="job" value='{"modelname":"tutorials\\FlexSim%202020%20Update%202\\Test01","timeout":3600,"priority":5,"setupcommands":[{"command":"settable=GlobalTable1","data":"values=[[\"firstParam\",1],[\"secondParam\",2],[\"thirdParam\",3]]"}]}'>
<input type="submit">
</form>
</body>
</html>

Thank you for advice.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Youichi I commented ·

Did Test01 have a GlobalTable1 saved in it already?

0 Likes 0 ·
Youichi I avatar image Youichi I Jason Lightfoot ♦♦ commented ·

Yes, I did it.

0 Likes 0 ·
globaltable1.jpg (35.8 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Youichi I commented ·

And how are you checking that the value changed in the new instance of FlexSim and the model that it loaded?

0 Likes 0 ·
Youichi I avatar image Youichi I Jason Lightfoot ♦♦ commented ·

I posted below command to FlexSim Web server.

http://127.0.0.1/webserver.dll?createinstance=tutorials\FlexSim%202020%20Update%202\Test01

I saw the new instance of the model in FlexSim.

After that, I ran the html and clicked submit button and I checked the value of the new instance of the model.


0 Likes 0 ·
Show more comments
Phil BoBo avatar image Phil BoBo ♦♦ Youichi I commented ·

The form in your html is sending a "submitjob" query. You aren't querying a specific instance. The "submitjob" query adds the job to a list of jobs to run on the server by creating an instance for each job, as explained in the Jobs section of https://docs.flexsim.com/en/Reference/DeveloperAdvancedUser/Webserver/

If you want to query an open instance, you don't use "submitjob". You use "queryinstance" as explained in the Instance Queries section of the documentation (just after the Jobs section).

0 Likes 0 ·
Youichi I avatar image Youichi I Phil BoBo ♦♦ commented ·

I understand how it works.

However, the documentation does not describe how the parameters are received by FlexScript.

Table gt = Table("GlobalTable1");
gt[1][1] = 123; // OK
gt[1][2] = parameter_name; // ???
0 Likes 0 ·
Show more comments