question

Li ze avatar image
3 Likes"
Li ze asked Li ze commented

How Can I Use LabelIndex?

FlexSim 20.1.0
flexsim 20.1.0
5 |100000

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

Matt Long avatar image
1 Like"
Matt Long answered Li ze commented

This is a documentation error. Accessing labels using an index number is not supported. If there is a reason you aren't able to access the labels by name, you can get the labels by index if you first get the labels node.

The following code will get you what you want:

current.attrs.labels.subnodes[1].value = 2;

attrs gives you access to all of the object's attributes (when looking in the tree, the nodes with blue names). Then you get the labels node, and access the subnodes of label which is an array. I hope this helps!

· 8
5 |100000

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

Li ze avatar image Li ze commented ·

Thank you very much.

There is another error in the manual:

0 Likes 0 ·
1588216835769.png (16.6 KiB)
Joerg Vogel avatar image Joerg Vogel Li ze commented ·

@Li ze, Maybe you open another question, because the documentation is wrong there, too. It is much easier to find an answer in a question than in a comment. Many thanks!

0 Likes 0 ·
Li ze avatar image Li ze Joerg Vogel commented ·

Yes I know that.

I just don't like to write much cause my bad writing .

0 Likes 0 ·
Matt Long avatar image Matt Long Li ze commented ·

The first comment in that image //first slot item is correct. The two references to bay we will also correct to say slot item. Thanks.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel commented ·

@Matt Long, @phil.bobo, it seems that the sub class “labels” and the attribute “labels” are misleading a bit, aren’t they? Perhaps the progress in development of this sub class stopped too early?

Object.labels.assert(..) vs. Object.attrs.labels.
0 Likes 0 ·
Matt Long avatar image Matt Long Joerg Vogel commented ·

Process flow uses the same code for accessing token labels as the object accesses its labels. Since tokens are allowed to have parent labels, and parent of parent labels etc, it didn't make sense to access labels by rank. We decided not to implement that as an option. There also isn't any real advantage to accessing by index rather than by name. If you're accessing data by index you might as well use a label table.

1 Like 1 ·
Joerg Vogel avatar image Joerg Vogel Matt Long commented ·

@Matt Long, thank you for pointing to the connection with tokens. Sometimes I forget to look at the whole world of FlexSim.

1 Like 1 ·
Show more comments
tannerp avatar image
0 Likes"
tannerp answered Li ze commented

What is it you're trying to accomplish with the label index? If you're trying to set a label, I suggest using a trigger. That way, you can specify the exact label and what value you want to set it to be.


· 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.

Li ze avatar image Li ze commented ·

Thank you very much!

I'm wondering if it's a User Manual Error.

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.