question

Henna N avatar image
0 Likes"
Henna N asked Henna N commented

Create and name the part

Hello, In the model when part arrive at Queue1 it creates a 3 quantity of its part in Queue2 and name same as the item it has been created but the parts created is not taking the names as item in Queue1. When part "a" enter in create 3 quantity of part and name all three quantity as "a" same as follows for pat "b". Please do help

Thank you

Create part.fsm

FlexSim 20.0.10
object namecreate part
create-part.fsm (30.1 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

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Henna N commented

A event driven create token activity acts on an entry event of a queue and assigns a reference to involved item to a token as a label called "item".

You create three items in a process flow create object activity. You assign those three items to an array called "items". In a custom code activity you rename the array reference to the same name as the item, which was created by the event driven source activity. Unfortunately doing something with an array reference works only on the first element on an array.

This means you have not renamed all elements but only the first

token.items.name = token.item.name; 

is

token.items[1].name = token.item.name;

this is a convention in addressing an array

you need to rename each single element reference in an array to fulfill what you want to achieve by a loop for example so:

for (int index 1; index <= token.items.length; index++)
    token.items[index].name = token.item.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.

Henna N avatar image Henna N commented ·
Thank you @Joerg Vogel this exactly what i wanted. It worked!!!
0 Likes 0 ·