Coding in flexscript

Coding in flexscript

j08j
Not applicable
58 Views
8 Replies
Message 1 of 9

Coding in flexscript

j08j
Not applicable

[ FlexSim 24.0.2 ]

I have some questions about flexscript coding, how can I execute these steps using flexscript?

1. Modify the parameters of exponential distribution in the source property.截圖-2024-06-13-下午25557.png

2. Add a dashboard that expresses staytime in the form of a table, and add objects Queue and ASRSvehicle.截圖-2024-06-13-下午25433.png截圖-2024-06-13-下午25506.png

3. A piece of code to clear dachbord. I hope that every time the program is executed, the old dashboard will be deleted and rebuilt instead of adding new dashboards all the time.

Thanks for your help.

0 Likes
Accepted solutions (1)
59 Views
8 Replies
Replies (8)
Message 2 of 9

j08j
Not applicable

Can anyone help me solve this problem?

I really appreciate it.

0 Likes
Message 3 of 9

moehlmann_fe
Explorer
Explorer
Accepted solution

1) Either set the source to use parameters instead of fixed values and then change those parameters. Or edit the text of the code node ("macth" and "replace" methods of the string class).

capture1.png

2) "applicationcommand("adddashboard")" to add a new dashboard. For the rest see the link.

https://answers.flexsim.com/questions/148499/how-to-add-a-output-bar-chart-in-the-dashboard-usi.html

3) Just delete the subnodes of the "Dashboards" and "Statistics" in the Tools folder.

capture2.png

0 Likes
Message 4 of 9

j08j
Not applicable

I tried following the reference link:

Object dashview=views().find("active>Documents/Dashboard/1+/~");
Object chartview=views().find("viewslibrary/Dashboard/Output/ThroughputTable");
Object chart=function_s(dashview,"createGraphWindow",chartview,1);
Group group = getvarnode(chart,"replacements").subnodes["Objects"].value;
group.addMember(Model.find("Queue"));

but no success, and get an error on Line 4.

截圖-2024-06-18-上午85111.png

Can you help me modify it?

Thanks a lot.

0 Likes
Message 5 of 9

moehlmann_fe
Explorer
Explorer

The location of the chart definitions changed. You just have to adjust line 2.

Object chartview=maintree().find("project/exec/globals/ChartTemplateDefinitions/Output/ThroughputBar");

Check the path shown above to find the names of other chart types.

0 Likes
Message 6 of 9

j08j
Not applicable

Thanks, it executed it successfully.

I have another question. Currently, it displays Throuput information. How can I change it to calculate WIP?

0 Likes
Message 7 of 9

j08j
Not applicable

Or another way, I have manually added the dashboard, I only need to add the object to be tracked through script.截圖-2024-06-18-下午44452.png

The code may like?

//Point to an existing dashboard
Object Staytime = maintree().find("Tools/Statistics/Staytime");

//Add Objects "Queue"
.addMember(Model.find("Queue"));

Is this method feasible?

0 Likes
Message 8 of 9

moehlmann_fe
Explorer
Explorer

If you want to add other chart types you can look up the path in the main tree to see what charts are available and what their name is.

capture1.png


To add an object to an existing chart you'd start at line 3 of the code by providing the reference to the chart template.

capture2.png

Object chart = Model.find("Tools/ChartTemplates/Staytime");
Group group = getvarnode(chart,"replacements").subnodes["Objects"].value; group.addMember(Model.find("Queue"));
0 Likes
Message 9 of 9

j08j
Not applicable
Thank you! It works very well!
0 Likes