Page 1 of 1

Multiple 'send to' - statements

Posted: Wednesday 21 March, 2012 - 21:26
by iGeneration
Dear sir, madam,

I recently bumped into a problem with ED I can't solve. I have several products going through several servers. Each product has it's unique sequence through the servers. What I'm looking for is to expand the send-to-statement '6. By atom name: if the atom name matches AtomName then send to channel 1, else 2. I want this more like:
Matches atom1, send to channel 4,
Matches atom2, send to channel 1,
Matches atom3, send to channel 3,

Could you please help me?

Kind regards,

Bas

Re: Multiple 'send to' - statements

Posted: Thursday 22 March, 2012 - 14:53
by Josie
Dear Bas,
Firstly, you can press the small button under the arrow beside the "Send to" blank, to see the 4D Script codes.
And then more specifically, you can realize your intention in either ways:
The first one is using "if" function:

if(
CompareText(Name(Rank(1,c)),[Atom1Name]),
4,
if(
CompareText(Name(Rank(1,c)),[Atom2Name]),
1,
if(
CompareText(Name(Rank(1,c)),[Atom3Name]),
3
)
)

the second solution is to use "Case":
Case(
WhichIsTrue(
CompareText(Name(Rank(1,c)),[Atom1Name]),
CompareText(Name(Rank(1,c)),[Atom2Name]),
CompareText(Name(Rank(1,c)),[Atom3Name])
),
4,
1,
3
)


Hope it helps,
Best regards,
Josie

Re: Multiple 'send to' - statements

Posted: Thursday 22 March, 2012 - 23:08
by iGeneration
Dear Josie,

Thanks for your reply. I'm one step closer to the solution!
I tried the if-function. the product will go into the queue, but will not leave the queue to go to another queue (even if I remove all but one if-statement).
Could you please help me?

Re: Multiple 'send to' - statements

Posted: Friday 23 March, 2012 - 09:14
by Josie
Dear Bas,
Can you attach here your model or at least the part that went wrong? I cannot judge what happen just basing on the information you gave me...

KR
Josie

Re: Multiple 'send to' - statements

Posted: Friday 23 March, 2012 - 15:33
by iGeneration
I've attached the case.

I'm trying to get 4 products through 5 sets of machines. Every product has his own cycle time and his own route to follow through the machines.
I'm using the lower queue-atoms to sort of 'guide' the product atoms to their next server. Queue 25 is linked to 4 other queues, which queue the atom for going into the server.

I hope my explanation was clear.

KR,

Bas

Re: Multiple 'send to' - statements

Posted: Monday 26 March, 2012 - 11:22
by iGeneration
Solved it. Rookie mistake: I didn't give the products a specific name, so the 4ds script was unable to sort.

Thanks for everything!