question

Josué Islas avatar image
0 Likes"
Josué Islas asked Josué Islas commented

How do I assign the SKU name to every item from my inventory?

2023.09.24 CEDIS WL.fsm

Hi, How do I assign the SKU name to every item from my inventory located in an rack address using global tables? In my model I use 695 positions and 695 SKU, 1 slot per SKU.

FlexSim 23.1.3
global tablerackslotskuaddress
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 Josué Islas commented

To do it after all items have been created, you can use the code snippet below (this assign a label named SKU, you can of course also set the name of the item)

Table locations = Table("Locations PTP");
for(int row = 1; row <= locations.numRows; row++) {     string address = locations[row][1];     Storage.Slot slot = Storage.system.getSlot(address);     if(slot)     {         for(int i = 1; i <= slot.slotItems.length; i++)         {             slot.slotItems[i].item.SKU = locations[row][2];         }     } }

If you want to do it directly when each item is created, I would recommend to first create a Map that links the addresses and SKUs, since it will be much faster than looking up the correct row for each item.

In the attached model I use a global variable to store the map and fill it in the model reset trigger.

20230924-cedis-wl-fm.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.

Josué Islas avatar image Josué Islas commented ·
Wow! Thank you so much!
0 Likes 0 ·