Troubles with conditional statement

All topics specific to modeling questions in Enterprise Dynamics
Post Reply
Mvrielink
Posts: 2
Joined: Thursday 01 December, 2016 - 14:56

Troubles with conditional statement

Post by Mvrielink »

Hello,

I am experiencing some trouble getting the conditional statement to work. I've got a very easy setup but there's one part that won't work. The setup is as follows:

Source sends orders to a queue. The max capacity of Queue 1 is 20 orders. An order that comes in and that will exceed the 20 limit should go to Sink 2, rather than to Queue 1. I've tried searching the web for a solution, but so far all i've found is about using 4D script, which i'm not familiar with. In the sample i've uploaded there are no connections to Sink 2 yet, since at this point i'm not sure if it should come from Source 1 or Queue 1.


Is there anyone that can help me with this problem?
Thanks in advance.

Maarten
Attachments
First phase.mod
(34.88 KiB) Downloaded 208 times
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: Troubles with conditional statement

Post by HarryBunnik »

Ha Maarten,

What you'll have to do is make a connection from your Source (use 2nd outgoing channel) to the Sink2. Then you can use the SendTo statement on the Source to check if the Queue has space. If that is the case the product should be send on through channel 1 (connection to the queue), otherwise it must be send through channel 2 (connection with Sink2).

To make the connection from the Queue to the Sink has not so much use, since the capacity of the queue is limited to 20. So there will never be more then 20 products inside. Therefore you can't write useful code to have the 21st product going to the sink.

You can have a look in the help at "Category Atom Reference" for more understanding about how atoms are related.

I hope this helps you a bit.

Cheers,

Harry
Mvrielink
Posts: 2
Joined: Thursday 01 December, 2016 - 14:56

Re: Troubles with conditional statement

Post by Mvrielink »

Hi Harry,

After reading your solution it seems so simple it's odd how I could not have figured it out.
Thanks a lot for your help!


Maarten
Post Reply