question

mm_y_2406 avatar image
1 Like"
mm_y_2406 asked Jeanette F commented

How to search if a specific label of a specific label of a token exist?

I want to check if my label of label of the token = token.Pallet.Destination exist using objectexists(token.labels["labelName"]) but it doesnt work. What should I use instead?

FlexSim 23.1.0
check if exist
· 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.

mm_y_2406 avatar image mm_y_2406 Joerg Vogel commented ·

I tried this method but it didn't work. I am using it in the condition of the statistic collector to only extract the data if token.Pallet.FinalDestination exist. Is it supposed to be objectexists(data.token.labels["Pallet.FinalDestination"])? 1708515642630.png

0 Likes 0 ·
1708515642630.png (43.6 KiB)
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @mm_y_2406, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

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

When checking for the labels you either do it in two steps: Check if "Pallet" exists, then check if "FinalDestination" exists.

objectexits(data.token.labels["Pallet"]) && objectexits(data.token.Pallet.labels["FinalDestination"])
data.token.Pallet? && data.token.Pallet.FinalDestination?

Or you chain multiple checks together, but this only works with class properties, as described here, so the expression becomes slightly more convoluted.

objectexists(data.token.labels["Pallet"]?.value?.labels["FinalDestination"]?.value)
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.