question

SudheerReddy avatar image
0 Likes"
SudheerReddy asked Regan Blackett edited

Assign Labels throwing error

assignlabels.fsm

As shown in below image I am pulling 3 items from the list and trying to assign label to the token.pulled( token.pulled is array as shown in above image). How to assign a label called Time to the token.pulled in process flow only.

Am attaching my model for your reference.

Thanks

FlexSim 19.1.2
assign labels
doubt1.jpg (34.4 KiB)
doubt2.jpg (31.4 KiB)
doubt1.jpg (34.4 KiB)
assignlabels.fsm (27.0 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

·
Regan Blackett avatar image
1 Like"
Regan Blackett answered Regan Blackett edited

I tried to run your attached model but it just runs forever without any pullers leaving the Pull activity. It looks like nothing is getting pushed to the list to me. Also the Assign labels activity doesn't look like your images here.

So based on the images, I'm guessing you are trying to add the Time label to all the elements of the 'pulled' array once the puller gets all three boxes?? The errors are probably because you are saying to assign the label to token.pulled; which works fine if you only pulled one thing. By having an array in token.pulled, Assign Labels needs to know which thing like token.pulled[1] or token.pulled[2]. Specifying the array doesn't work.

You would need something like a Subflow that says for each member of the array, create a child token that references a single member of the array, and assign the label to that array member.

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

SudheerReddy avatar image SudheerReddy commented ·

@Regan Blackett

23087-assignlabels.fsm

Above is the updated model. Which I am supposed to upload.

Thanks for the answer.

But running the Subflow is the only option or do we have alternate ways to achieve the same

0 Likes 0 ·
Regan Blackett avatar image Regan Blackett ♦ commented ·

I can think of two other ways to do the same thing. If the number of pulled elements never varies, do 3 separate Assign Labels activities in succession, and say their assign-to's are token.pulled[1], token.pulled[2], token.pulled[3]. You could also use a Custom Code activity and write a for() loop like this:

for(int i = 1; i <= token.pulled.length; i++){
	token.pulled[i].Time = Model.time;
}

The Subflow is the same idea as the for loop but with the logic exposed as activities rather than hidden in code, and both allow for the number of pulled members to be variable.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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