question

Brandon I2 avatar image
0 Likes"
Brandon I2 asked Brandon I commented

How to clear all flow items within a queue using process flow cleanly?

I have attached my model with what I've managed to achieve so far.

Basically this is what I would like to do:

When Queue 4, Queue 3, Queue5, and Queue 6 are all at maximum content, I want to sink/destroy everything inside them.(Just clear out everything simply) This must all happen together at the same time once they're all full.

I've tried using the following code snippet from another post: https://answers.flexsim.com/questions/48787/how-to-use-script-to-destroy-all-or-certain-number.html

The problem is that is does work... but the batches from the previous connected queues (1 and 2) stop emptying themselves after the batch count is reached when the process flow is executed.

Is there something that I have done wrong? I would think it's something to do with the code snippet, or how the process flow itself is structured.

Kind regards,

Brandon

queuesqueue content
· 5
5 |100000

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

Braydn T avatar image Braydn T commented ·

@Brandon I2 Hey Brandon, I think your model did not attach. Could you please attach it?

0 Likes 0 ·
Brandon I2 avatar image Brandon I2 commented ·

This is the file: https://filebin.net/uqt3sp660r2asqso

For some reason the file doesn't want to upload as an attachment.

0 Likes 0 ·
Brandon I2 avatar image Brandon I2 commented ·

test-autosave.fsm

Got it, sorry!

0 Likes 0 ·
test-autosave.fsm (48.6 KiB)
Braydn T avatar image Braydn T Brandon I2 commented ·

@Brandon I2

Are you using the delete item because you want them all to flush at the same time? because if so, I think you should close the output ports of the queues, and then open them in your custom code block instead of deleting items. Its best not to mix commands like that with 3d logic.

0 Likes 0 ·
Brandon I2 avatar image Brandon I2 Braydn T commented ·

Yeah, I just want to flush them all after they all reach the maximum content. Can you maybe suggest a better way to clear out the queues without the code snippet in the process flow?

0 Likes 0 ·

1 Answer

Braydn T avatar image
0 Likes"
Braydn T answered Brandon I commented
@Brandon I2

I open and close the ports in the code boxes. I hope this helps!

updated.fsm

updated.fsm (47.2 KiB)
· 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.

Brandon I avatar image Brandon I commented ·

Thanks @Braydn T, it works just the way I wanted to. I see what you meant.

0 Likes 0 ·