"Send to" script which depends on HR availabilty

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
MartinL
Posts: 28
Joined: Tuesday 03 February, 2015 - 21:43

"Send to" script which depends on HR availabilty

Post by MartinL »

Hello,

I would like ask some help with a "Send To" 4DScript.

I have a queue with two output channels ( Server 1 and 2). Server 1 uses HumanResource and work is regulated by HumanResourceSchedule. Server 2 don't use HR and is available all the time.

Need some help with followong script:

If HumanResourceSchedule Availabilty = 0 (HR available) the product is sent to Output Channel 1,
but if HumanResourceSchedule Availabilty = 1 (down), then Output Channel 2.

Best Regards
tobias.reithmann
Posts: 7
Joined: Monday 02 March, 2015 - 16:34

Re: "Send to" script which depends on HR availabilty

Post by tobias.reithmann »

Hello MartinL,

Have a look in the Send To help under no. 10: Conditional Statement. The code of the standard statement would be something like

Code: Select all

if(1 > 0, 1, 2)
i.e. if some condition is true, take channel 1, otherwise take channel 2. You just need to adapt the conditional statement to your needs. That would be something like:

Code: Select all

if(Att([Available], first(refHumanResourceSchedule)) = 0, 1, 2)
The first() statement is due to the inner structure of the HumanResourceSchedule atom (I assume you use the time scheduler).
Post Reply