Page 1 of 1

SEND TO.. Little Help With Nesting...

Posted: Thursday 10 April, 2014 - 19:13
by Spaggio86
Hello everyone.. Sorry to bother you but I have a specific "send to" question to ask.

I'v tried to reach the code on my own but it's very difficult for me to write codes in 4D script
with the concept of nesting. The problem it's the seguent:

I have 1 queue, 6 servers and 3 different products arriving at the queue.
All the products have a NAME and I want to send them to the different servers in different ways
as function of their name.

PRODUCT NAMED [RED]: send to channel 1,2 or 3 randomly
PRODUCT NAMED [BLUE]: send to channel 4,5 or 6 randomly
PRODUCT NAMED [GREEN]: send to channel 1,2 or 3 randomly if they are opened, else sent to 4,5 or 6 randomly.

How can I write this "send to" code on the queue?

Thanks in advance.

Re: SEND TO.. Little Help With Nesting...

Posted: Monday 14 April, 2014 - 09:38
by Nick
Hi Spaggio86,

The functions 'Case' and 'WhichIsTrue' are very useful for comparing multiple statements.

Code: Select all

Case(
 WhichIsTrue(
   statement 1,
   statement 2,
   statement 3),
  dUniform(1, 3),
  dUniform()
  dUniform(if(OCReady(dUniform(1,3), c)....)
)
)
Regards, Nick

Re: SEND TO.. Little Help With Nesting...

Posted: Monday 14 April, 2014 - 22:22
by Spaggio86
Thanks Nick, I'v solve my problem!!!