question

Sebastien avatar image
0 Likes"
Sebastien asked Sebastien commented

Acquire Location with Sort By not working as expected

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

FlexSim 22.0.13
acquire location
5 |100000

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

1 Answer

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Sebastien commented

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


1678793647847.png (2.0 KiB)
1678793781019.png (3.3 KiB)
1678793813556.png (3.3 KiB)
· 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.

Sebastien avatar image Sebastien commented ·
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 0 ·
Felix Möhlmann avatar image Felix Möhlmann Sebastien commented ·
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 0 ·
Sebastien avatar image Sebastien Felix Möhlmann commented ·
Ok ! Wonderful. Thank you very much @Felix Möhlmann .
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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