question

Jay Khedekar avatar image
0 Likes"
Jay Khedekar asked Andrew O commented

What should be the return value for Wait for an Event custom FlexScript Code?

I have written a flexscript code to wait if the queue length is betweel 0 and 2. If that's true I return 1?


Is returning 1 the eight way to do it?


if(model.find("Queue1").subnodes.length >=0 && model.find("Queue1").subnodes.length <2){
    return 1;
}
FlexSim 21.1.5
flexscriptwaitforevent
· 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.

Andrew O avatar image Andrew O commented ·

Hi @Jay K9, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

Just use the gui:

1662065853241.png


1662065853241.png (12.6 KiB)
· 4
5 |100000

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

Jay Khedekar avatar image Jay Khedekar commented ·
That doesn't help because initial queue length is 0. So, it will always wait. I would prefer using a code for something like this, could you help me with what should the code return?
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Jay Khedekar commented ·
Then you have not checked the box "Fire If Initial Value Meets Rule".
0 Likes 0 ·
Jay Khedekar avatar image Jay Khedekar Jason Lightfoot ♦♦ commented ·
I tried checking that. So that works in the first run but it sorta blocks the process flow. Need to check what that is. But let's say, if I do wanna use flexScript I would like to what what can it return? It might come in handy
0 Likes 0 ·
Show more comments