question

Rocio A avatar image
0 Likes"
Rocio A asked Logan Gold commented

Initial inventory in a rack

Hello ,

I have made a small model about an initial inventory in a rack.

The way I found to do it is by run sub Flow.

If I don't do it by Run sub Flow it gives me the following error:


time: 0.000000 exception: FlexScript exception: Property Type not available for Variant with value Array[50]: {/Box1,/Box1~2,/Box1~3,/Box1~4,/Box1~5,/Box1~6,/Box1~7,/Box1~8,/Box1~9,/Box1~10,/Box1~11,/Box1~12,/Box1~13,/Box1~14,/Box1~15,/Box1~16,/Box1~17,/Box1~18,/Box1~19,/Box1~20,/Box1~21,/Box1~22,/Box1~23,/Box1~24,/Box1~25,/Box1~26,/Box1~27,/Box1~28,/Box1~29,/Box1~30,/Box1~31,/Box1~32,/Box1~33,/Box1~34,/Box1~35,/Box1~36,/Box1~37,/Box1~38,/Box1~39,/Box1~40,/Box1~41,/Box1~42,/Box1~43,/Box1~44,/Box1~45,/Box1~46,/Box1~47,/Box1~48,/Box1~49,/Box1~50}. Must by a treenode type Variant. at MODEL:/Tools/ProcessFlow/Object/Change Visual>variables/codeNode at line 4


Would there be any other way to do it?

and another question:

How can I make sure that within each Rack Type the placement of the boxes in the rack is not all together, is it possible?

Thanks in advance

Rack.fsm

FlexSim 24.1.1
proces flowarrayrun sub flowvisual change
rack.fsm (41.6 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

David Chan avatar image
0 Likes"
David Chan answered Logan Gold commented

To answer your question.

1. The way that you create the item causes the item reference are stored in an array token.item. Hence you will need to reference to every item by token.item[ranknum].

2. You can use Find Slot in the process flow. In the search criteria, you can order by content after match by label. The model is attached.

David

rack_DC.fsm


rack-dc.fsm (42.2 KiB)
· 2
5 |100000

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

Rocio A avatar image Rocio A commented ·

Hello @David Chan ,

For the 1st answer: without running subflow I entered the token.item[ranknum] but it gives me this error.

1729596677590.png

How should I do it?

Thanks in advance.

Rack_1.fsm

0 Likes 0 ·
Logan Gold avatar image Logan Gold ♦♦ Rocio A commented ·

Hey @Rocio A, ranknum is just a placeholder to indicate you need to use a number as part of token.item[] to properly reference one of the items. Using the creationRank variable in the Run Sub Flow activity is a good example of what you can use in place of ranknum.

With what you're trying to do (create an initial inventory), when you create multiple items at once and store the references to all the items in one label like token.item, you need to loop through all the items somehow when doing things like setting labels, moving the items into a Rack, or changing their colors.

I think using the Run Sub Flow activity is the easiest way to do it. However, you could also use an Assign Labels activity to increment a label, do all the same things the sub flow is doing but reference that label instead, then use a Decide activity to determine if all the items have gone through the logic. Here is an example of what that would look like (rack-1_FS1.fsm). Again, this logic is still looping through all the item references in the token.item label in a similar way to how the sub flow does it.

0 Likes 0 ·
rack-1-fs1.fsm (43.5 KiB)