AnswerHub Upload Issue
Our AnswerHub community currently has a bug that prevents you from attaching your model or other files to your questions. AnswerHub is aware of this issue and they are working on a fix. Until we receive their patch, you can upload your models and other files to FlexSim's file share site. Include the file name in your question so that we know which upload to reference.

question

Jon Abbott avatar image
0 Likes"
Jon Abbott asked api answered

How to delete all labels on a token using FlexScript?

I'm trying to delete all labels on a token using FlexScript. I've tried this example but it didn't seem to work. Is there another way to delete all labels on a token using FlexScript? Thanks in advance for your help.

FlexSim 20.0.5
labelstokenflexsim 20.0.5delete
· 2
5 |100000

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

Create Token activity to get a new token, then you send the token with all labels simply into a sink activity.

0 Likes 0 ·

Thanks @Jörg. So is there no way to do this using FlexScript? I can remove one token label using FlexScript with no problem, but removing all labels at once seems to not work for me.

0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Jon Abbott commented
token.as(treenode).subnodes["labels"].subnodes.clear();
This works for a custom code.
· 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.

Thank you @Jörg, this works. I was hoping it would be as simple as

token.labels.destroy();

or

token.labels.clear();

But your code still works nicely. :^) Thanks again.

0 Likes 0 ·
api avatar image
0 Likes"
api answered
Closing outdated question
5 |100000

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

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.