question

Fernando Q3 avatar image
0 Likes"
Fernando Q3 asked Fernando Q3 commented

Wrong token label reference to read object´s label

Hi,

I am trying to reference the token label named "elegido", based on the queue with the longest content (among T1, T2 and T3) at "Custome Code1" (in process flow), to write into "Globaltable1" the object´s "Asignado" label value, but it does not work. ¿What would be the right function to make it work?

Prueba asignación queues.fsm

FlexSim 22.1.1
write to global table
5 |100000

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

Jeanette F avatar image
0 Likes"
Jeanette F answered Fernando Q3 commented

Hello @Fernando Q3,

Your label called "elegido" contains a pointer to the object. In the Custom code when you are trying to use it to select the row it needs to be a string.

token.elegido.name //returns string of the name of the object in the pointer label "elegido"

I also took out the slashes in the rows names in the Table

prueba-asignacion-queues_1.fsm


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

Fernando Q3 avatar image Fernando Q3 commented ·
thanks a lot Jeanette.
0 Likes 0 ·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Fernando Q3 commented

token.elegido is storing a pointer to one of the queues. You need to take the pointer and turn it into a string to match the row header of GlobalTable2.

The easiest way to do this is to get the object's name:

token.elegido.name

If you use this method you should change the row headers in GlobalTable2 so they don't start with a slash (Queue5 instead of /Queue5).

Alternatively, if you don't want to change the row headers you could use either of these to get the name with a slash:

token.elegido.getPath(model())
"/" + token.elegido.name
· 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.

Fernando Q3 avatar image Fernando Q3 commented ·
thanks again Matthew
0 Likes 0 ·