Acquire Location with Sort By not working as expected

Acquire Location with Sort By not working as expected

sebastien_b49
Advocate Advocate
6 Views
4 Replies
Message 1 of 5

Acquire Location with Sort By not working as expected

sebastien_b49
Advocate
Advocate

[ FlexSim 22.0.13 ]

Hi,

I am trying to make a dynamic Location Acquire where the group acquired changes according to the patient coming in. This works with a custom code within the Location resource.

Then when I try to sort the group members (which are multi locations) by labels, the patient do not acquire the least occupied chairs as reproduced in the test model attached.

I do not know how to make this works although it seems simple. Can anybody help me ?

2023-03-14_Test_Chairs_Acquire.fsm

0 Likes
Accepted solutions (1)
7 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Observer
Observer
Accepted solution

In the case of multilocations, the objects that get acquired are the individual drawsurrogates.

1678793647847.png

You correctly take this into account when incrementing/decrementing the label. However you also have to keep this in mind for the order expression. Since the drawsurrogates are the objects that get acquired, they are also the ones to be queried, so you have to shift the reference to their parent object first before reading the label.

1678793813556.png

or

1678793781019.png

Message 3 of 5

sebastien_b49
Advocate
Advocate
Great ! It worked. Thank you @Felix Möhlmann

I tried before to use up.up.up but I did not have the value.as(treenode) before it.
Could you explain to me what is usable in the Sort By field ? What is value in this case ?


0 Likes
Message 4 of 5

moehlmann_fe
Observer
Observer
In theory you should be able to use any FlexScript expression since the content gets pasted directly into a query string (I think). "value" is the thing that gets queried, so in this case the individual chair objects. That "value" needs to be cast as a treenode in the first case I honestly only found out through trial and error.
0 Likes
Message 5 of 5

sebastien_b49
Advocate
Advocate
Ok ! Wonderful. Thank you very much @Felix Möhlmann .
0 Likes