question

allison-cg avatar image
0 Likes"
allison-cg asked Jeanette F commented

how to label in batches

I have a model where I am labeling a pallet but the pallet itself already has a label and that label that the pallet has must have all the boxes it contains, how can it be done

FlexSim 23.2.2
labels
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

Jacob W2 avatar image
0 Likes"
Jacob W2 answered Jeanette F commented

Hi @Allison_CG,

You can do this by looping through the items within the pallet and then writing a label value onto each item. The following code is an example of one way to do this.

for (int i = 1; i < token.pallet.subnodes.length; i++){
Object box = token.pallet.subnodes[i];
box.labels.assert("Type");
box.Type = token.pallet.Type;
}

If you are creating the items in the pallet using a create object activity in process flow, you can add the label to the items while creating them.

You can also use a sub flow activity and loop through the items and assign a label to them while in process flow.

These are just a few ways that you can accomplish what you are trying to achieve.

· 3
5 |100000

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

allison-cg avatar image allison-cg commented ·

The code works but now it puts the label on the box and on the stowage it gives me a value of 0

1699905200179.png

1699905227486.png


0 Likes 0 ·
1699905200179.png (191.7 KiB)
1699905227486.png (190.4 KiB)
allison-cg avatar image allison-cg allison-cg commented ·

The label on the box is fine but the stowage gave 0

0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ allison-cg commented ·

Hello @Allison_CG

Just add a line of code to assign to the pallet as well. This would be placed outside the for loop.

token.pallet.labels.assert("Type");
token.pallet.Type = value;

or an assign label activity before or after the run sublow

0 Likes 0 ·