question

JacksonG avatar image
0 Likes"
JacksonG asked Jason Lightfoot edited

Destroy Object Question

I am trying to use the "Destroy Object" block to remove flowitems by batch number. I am unsure how to specify parameters in the "Destroy Object" block to remove only for a certain batch number. In the final queue in my model there are several items that have an associated batch number, the batch number is also attached to the token coming into the "Destroy Object" thread.


Destroy Flowitems Question.fsm

FlexSim 22.2.2
destroy object
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

Jeanette F avatar image
0 Likes"
Jeanette F answered Jason Lightfoot edited

Hello @JacksonG,

You will need some way to query the contents of the Queue. This can be done with a list. I have added a trigger on Queue 2 that pushes the items to a list. This list is then used in the process flow to pull the items that match the batch number. The items pulled from the list are then used in the Destroy Object activity.

destroy-flowitems-question_1.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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

You can also write a loop to scan the items in the queue and push those that match to an array that assign to a token label. Then in the Destroy activity you just refer to that array.

Or you can use this one line expression in an assign labels activity if for example you have set token.q to point to the queue:

Table.query("SELECT ARRAY_AGG(Item) FROM ((SELECT $2 AS Item FROM $1 WHERE $3="+token.BatchNumber+"))",token.q,$iter(1),$iter(1).BatchNumber)[1][1]
1 Like 1 ·