Add Array Data to a Node

Add Array Data to a Node

hoang_nk
Not applicable
226 Views
11 Replies
Message 1 of 12

Add Array Data to a Node

hoang_nk
Not applicable

[ FlexSim 22.1.2 ]

Hello guys,

I'm having trouble adding array data to a node in the model tree.

1665286393832.png

As you can see from the screenshot, I have a GUI from which I can write values to the 2 nodes "loadLoc" and "unloadLoc" (in red circles). It worked well when data types of the nodes were number, however I cannot write new values into these nodes when I change the data types to Array data. It keeps showing "array: Array[0]: {}".


Please can anyone help me on this?

Many thanks,

Hoang Nguyen


0 Likes
Accepted solutions (1)
227 Views
11 Replies
Replies (11)
Message 2 of 12

hoang_nk
Not applicable

@Jason Lightfoot could you help me with this? it seems to have something to do with data structure of Flexsim. Many Thanks!

0 Likes
Message 3 of 12

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

Can't see the end of your Array assignment - you should have .value on the end of the treenode expression if you don't already.

0 Likes
Message 4 of 12

hoang_nk
Not applicable
I do have the .value at the end of the expression in the code, but I cannot assign values to the node var, either by directly typing into the model or by using the GUI
0 Likes
Message 5 of 12

jason_lightfootVL7B4
Autodesk
Autodesk

Can you post the model with the steps you're taking to test it? Have you tried debugging your code using breakpoints to see what's going on?

0 Likes
Message 6 of 12

hoang_nk
Not applicable

GUI_example.fsm

here's the model I'm doing, could you tell me what I'm doing wrong here?

0 Likes
Message 7 of 12

jason_lightfootVL7B4
Autodesk
Autodesk

Your picture was misleading since it implied that the code shown was not working - but in fact that's irrelevant to your question.

I don't think you can edit an array using a coldlink and a single text edit box. Use a label on the object and the properties panel to edit the values or create 3 text edit boxes per array and use the apply or onkillfocus to set the values of the array.

0 Likes
Message 8 of 12

hoang_nk
Not applicable
Oh I see, I successfully tested it with Number and Text so thought that it could work the same with an array. So using the label on the Operator is the approach you meant?
0 Likes
Message 9 of 12

jason_lightfootVL7B4
Autodesk
Autodesk

It can be on the task executer or on a station/fixed resource.

0 Likes
Message 10 of 12

hoang_nk
Not applicable

GUI_example.fsm

Thanks for your help. Here's the model which I corrected, it now works as I would like it to. Could you see if it's wise to implement it this way? Many thanks

0 Likes
Message 11 of 12

jason_lightfootVL7B4
Autodesk
Autodesk

I meant use array labels:

1665479842979.png

Then double clicking them you can edit the values:

1665479922969.png

0 Likes
Message 12 of 12

Jeanette_Fullmer
Community Manager
Community Manager

Hi @Hoang Nk, was Jason Lightfoot'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 unaccept and comment back to reopen your question.

0 Likes