question

shanice.c avatar image
0 Likes"
shanice.c asked Felix Möhlmann answered

How could I refer to the object's Array labels?

Hello,

A Queue object has a two-length array label called "Zone". I have an "editable text" on dashboard, and hope to input a 2 characters values. The "editable text" has linked to the Queue object. So I hope to split these two characters, then put them separately into Array[1], and Array[2].

For example, The input is "AB", then Array[1] = A; Array[2] = B.

But how could I refer to the object's Array labels?

testarraylabel.fsm

FlexSim 21.0.10
array
testarraylabel.fsm (26.8 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

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

If you link directly to the array label the edit field will always revert to the current label value, because the data types don't match up.

Instead, link to a node that contains string data. In the attached model I added an extra node 'zoneString' to the queue's tree. This could also just be another label.

In the apply code, the string then gets split into an array of substrings and assigned to the array label.

/**Custom Code*/
treenode link = node("..>objectfocus+", c);

// Get the text and split the string in two
string textValue = getviewtext(c);
Array strings = textValue.split("", 2);

// Assign to label
Object Queue = ownerobject(link);
Queue.Zone = strings; 

testarraylabel_fm.fsm


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.