SEND TO.. Little Help With Nesting...

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Spaggio86
Posts: 12
Joined: Sunday 16 March, 2014 - 15:15

SEND TO.. Little Help With Nesting...

Post 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.
Nick
Posts: 48
Joined: Saturday 15 February, 2014 - 01:52

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

Post 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
Spaggio86
Posts: 12
Joined: Sunday 16 March, 2014 - 15:15

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

Post by Spaggio86 »

Thanks Nick, I'v solve my problem!!!
Post Reply