How to group labels?

How to group labels?

jarek_o
Not applicable
15 Views
4 Replies
Message 1 of 5

How to group labels?

jarek_o
Not applicable

[ FlexSim 17.1.1 ]

Hi all,

Imagine you have a lot of labels that connects catnames to their ages. I want to have these labels grouped in a "superlabel" called Cat_Ages. For example I assign a label to token.Cat_Ages called "Garfield" with value 5.

When I try this I get exception Error: Invalid assign to reference. although the label token.Cat_Ages does exist.

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

sam_stubbsYXX86
Community Manager
Community Manager

I'm not exactly sure I follow what you're trying to do. IF you want a label that has a reference to a lot of other labels, you'll need to set it as an array. A label array can be a list of references to other labels.

One of the most common ways people use label arrays is when pushing/pulling from a list. If you pull a number of items from a list, you can store references to them all in a label array.

Message 3 of 5

matt_long
Not applicable
Accepted solution

Labels can't have their own labels. Objects and tokens store labels. If you want a label that stores more information you can either use an array as Sam suggested (though that will not give you two values, the name and the age) or you can use subnodes on the label. A third option would be to have your Cat_Ages label actually be a reference to another token. You could create a dummy token that you use just for storing labels on. Then you can use straight dot syntax to get and set those values.

token.Cat_Ages.Garfield

Attached is a simple model showing this done.

catages.fsm

Message 4 of 5

jarek_o
Not applicable

Thanks for the answers @Sam Stubbs and @Matt Long.

The dummy toke suggestion is the most useful solution to what I'm thinking of. I was asking this question for future issues where tokens have an unacceptable number of labels...

Thank you,

Jarek

0 Likes
Message 5 of 5

ralf_gruber
Collaborator
Collaborator

Jarek,

in that case you might want to have all the information stored in a global table and have a token label with just a reference to the table information.

The other option would be to have the token reference a label on a 3D dummy object. Labels on 3D objects or FlowItems can have bundle data, allowing you to create a table in a label.

Best wishes

Ralf