question

Zach B3 avatar image
0 Likes"
Zach B3 asked Zach B3 commented

How to use Model.find to access label contained in variable

Hello, I am trying to store a label name in a variable, and then use Model.find("object").storedLabel to change the value of the physical label. But I am unable to figure out how to do this. This is what I currently have:

When I use Model.find("InputVariableController").propertyName, this code is not accessing the physical label of the InputVariableController.

FlexSim 20.0.0
variablefindmodel.find
capture.png (24.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.

1 Answer

Regan Blackett avatar image
1 Like"
Regan Blackett answered Zach B3 commented

The syntax you would need is:

Model.find(InputVariableController").labels[propertyName].value

By using the propertyName variable in the brackets like that, you searching for the string name of the label. Otherwise it assumes that the label is literally named propertyName.

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

Zach B3 avatar image Zach B3 commented ·

Thanks for the quick reply. This solved the problem, and now my labels are updating, but it is giving me this error:

FlexScript exception: Property "value" accessed on invalid node. at MODEL:/Tools/GlobalTables/OutputExcelInput>variables/resettrigger

I am storing this code in the reset trigger of one of my global tables.

0 Likes 0 ·
Braydn T avatar image Braydn T Zach B3 commented ·

@Zach B3

Could you upload the model that has this error?

0 Likes 0 ·
Zach B3 avatar image Zach B3 Braydn T commented ·

I actually just figured out the issue - there were not enough rows in the table which was causing this error. Thanks so much!

0 Likes 0 ·