Routing Output channels

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
huppenuckel
Posts: 8
Joined: Friday 29 June, 2012 - 10:11

Routing Output channels

Post by huppenuckel »

Hi I need to route 20 Products to Output-channel 1, next 20 to Outputchannel 2 and so on...how to do this?


thx a lot
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: Routing Output channels

Post by MarvinH »

Hello!

Try using the Mod function again. Assume you have 5 output channels, each will receive 20 products in a row. Then you can use the Mod function like this:

Code: Select all

Case(
  WhichIsTrue(
    Mod(Output(c), 100) < 20,
    Mod(Output(c), 100) < 40,
    Mod(Output(c), 100) < 60,
    Mod(Output(c), 100) < 80,
    True
  ),
  1,
  2,
  3,
  4,
  5
)
Using this code, the first 20 product will go to channel 1, the second 20 products will go to channel 2 etc. In case your number of channels is different, the number of statements within the WhichIsTrue and the second parameter of the Mod function should be altered accordingly.

Good luck!

Kind regards,

Marvin
huppenuckel
Posts: 8
Joined: Friday 29 June, 2012 - 10:11

Re: Routing Output channels

Post by huppenuckel »

HI and thx,

but the problem is a bit different:

first 20 - to channel 1
second 20 - to channel 2
third 20 - to channel 1


and so on....

so i had to define for each 20 the routing... isn't there any routine for this?
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: Routing Output channels

Post by MarvinH »

Hello!

The example I gave assumed 5 output channels. In case you only have 2 output channels, it becomes easier:

Code: Select all

If(
  Mod(Output(c), 40) < 20,
  1,
  2
)
For more information about the Mod function, please refer to the Help file.

Kind regards,

Marvin
Post Reply