How to Reevaluate Resource Activity List Back Orders via Code

How to Reevaluate Resource Activity List Back Orders via Code

stan.e.davis
Advocate Advocate
14 Views
5 Replies
Message 1 of 6

How to Reevaluate Resource Activity List Back Orders via Code

stan.e.davis
Advocate
Advocate

[ FlexSim 21.2.4 ]

Probably a simple answer, but how does one call the reevaluateBackOrders() method on the list behind an object-mode Resource activity via custom code?

I tried this but no joy...

List mylist = Model.find("Tools/ProcessFlow/ProcessFlow/Resource");

mylist.reevaluateBackOrders();


Thanks, Stan

0 Likes
Accepted solutions (1)
15 Views
5 Replies
Replies (5)
Message 2 of 6

stan.e.davis
Advocate
Advocate

Tried this. No errors, but didn't cause the resource to reevaluate the back orders...

Object myobj = Model.find("Tools/ProcessFlow/ProcessFlow/Resource");

List mylist = myobj.attrs.variables.subnodes["list"];

mylist.reevaluateBackOrders();



0 Likes
Message 3 of 6

moehlmann_fe
Explorer
Explorer
Accepted solution

The activity creates copies of the list for each process flow instance. If it is an instanced flow, these will be subnodes of "...>stats/instances" ("..." is the path to the activity object). In case of a general process flow, there is only one instance under "...>stats/globalInstance".

The actual list node can be found under those instance nodes.

1636712665137.png

The following code should then work to reevaluate the back orders:

List resourceList = Model.find("/Tools/ProcessFlow/ProcessFlow/Resource>stats/globalInstance/list");
resourceList.reevaluateBackOrders();
0 Likes
Message 4 of 6

Matthew_Gillespie
Autodesk
Autodesk
@Felix Möhlmann @Stan Davis The caveat here is that we don't make any guarantee that this will work in future versions if we make changes to the underlying structure. The only fully supported way to do this currently is to use a process flow List activity and point it at a global list and then call reevaluateBackOrders() on the global list.


Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 5 of 6

stan.e.davis
Advocate
Advocate

Felix, That worked. I had built a small test model with a single process flow. The list was still copied under the stats/instances. There is nothing under stats/globalInstance. Thanks again - Stan

0 Likes
Message 6 of 6

stan.e.davis
Advocate
Advocate
Understood. Too far committed with the current model to change. Thanks - Stan
0 Likes