question

shanice.c avatar image
0 Likes"
shanice.c asked Felix Möhlmann answered

How to use code to re rank the group member sequence by member's label value ASC

Hello, I have a group includes many members. and would like to use code to rerank their ranking by a numeric label value named "zone". How could I make this using code?

Also I'd like to know why I click the "Move the highlighted node down/up in rank by 1" to change the object's rank, but in the group properties still can't see it changes?

I would like my agv take resource from this group using the order by "Zone" ASC, this is why I ask this question, since the flexism would acquire from group by group member's order. Previously I order all members manually, now hope to look for efficient method.

1656645447310.png

Thank you!

testrank.fsm

FlexSim 21.0.10
groupsrank
1656645447310.png (95.3 KiB)
testrank.fsm (54.0 KiB)
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

Property is rank. You can rank only one tree node at a time. Be aware of current order, because it has got an influence of a set rank of members. You can mess up easily any order by setting a rank by a once ordered data. Such static ordered data is not true anymore, if you set a different rank for a member.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

Ordering the nodes in the tree does work, but the Group GUI doesn't immediately update. Either close and open it again or use 'repaintview()' to have it reflect the changes.

You don't have to order the objects in the group. You can just use the query field in the Acquire activity to pull them in the right order. This works for labels on the objects without any other changes. If you want to use a different property in the query, you would have to add a field to the resource's internal list.

1656660020392.png

1656660175210.png

The model attached also contains the necessary code to order the group members by the zone label. It uses a query to generate a table that has the members in the right order. Then it removes and adds them back in that order.

testrank_fm.fsm


1656660020392.png (14.7 KiB)
1656660175210.png (31.7 KiB)
testrank-fm.fsm (37.9 KiB)
5 |100000

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