question

Patrick Cloutier avatar image
0 Likes"
Patrick Cloutier asked Patrick Cloutier commented

How to sort release order in a Join Activity?

I have a ProcessFlow where I Split the tokens into 5 child tokens that go to 5 different places to do their things.

Then I use Join to re-join those tokens together before sending the resulting token to a final process.

All works great except that the tokens do not all arrive at the end in the same order they were created at first. I need them to arrive in the same order which is a sequence number on a label called token.sequence

The reason they don't arrive in the same order is that in the individual branches that the child tokens go through, some tokens might pass ahead of others and so get to the Join ahead of an earlier token which spent more time there. And the Join just releases the tokens when he has collected all 5 childs.

So I need a way for the Join to release the tokens in the order on label token.sequence and not mix the sequence.

Is there a way to do this?

Thanks a lot. Pretty stuck on this. I've read all material in the manual but can't find the answer.

FlexSim 20.2.3
flexsim 20.2.3token join
· 5
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Patrick Cloutier avatar image Patrick Cloutier commented ·

I found a possible solution where I organize the child processes to not let tokens bypass others and so they should all arrive at the end in the original sequence. I will try that.

By I'm still very interested to know if it's possible to automatically "sort in the Join" as indicated above.

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

@Patrick Cloutier I don't understand the question. Only one token leaves a Join activity, so it doesn't make sense to sort the release order. Are you talking about a Synchronize activity? Can you attach a sample model of what you're talking about?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Matthew Gillespie ♦♦ commented ·

You have a sequence of tokens A,B,C,D,E. You use activities to split, synchronize and join. A split activity creates child tokens A1, A2, B1, B2, C1,C2, D1,D2, E1, E2,...

After joining has been done, the sequence of tokens must result in A, B, C, D, E,.. But during different sub processes the child tokens arrive at joining activities in different order. How can you delay the C token to leave an activity after the B has been released, but C has been joined before B?

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier Joerg Vogel commented ·

Yes that's what I mean. It would be nice if we could have (in the Join) a field called "Release Sort Order". In my case I would enter token.sequence and the tokens would exit the Join in the order of token.sequence. So even if a token has all its children it can only be released if its the next in the sequence.

But as I write this comment, I realize maybe the solution lies in using Lists instead of Join.

And, as I said above, I already solved this differently so I don't want you guys to spend time on this now. Maybe it could be a suggestion? Or should I delete this question? Or should I make this comment an answer?

Thanks,

0 Likes 0 ·
Patrick Cloutier avatar image Patrick Cloutier commented ·

My alternate solution doesn't work. I need to find a way to sort the tokens in their original order at or after the Join.

I've attached the sample model. If you look at the order of the tokens in the final step, it is not the same as the original sequence in the Source.

I tried to add a sorting logic after the Join based on token.id but it doesn't work because the Split changes the token ids.

The order as to be at least the same as token.sequence.

Any ideas?

tests split-join-sort.fsm

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Patrick Cloutier commented

You can add a sequence number yourself based on a process flow label, and then try to pull the token's sequence number from a list (starting at 0 in the example). Then when you pull your number, push that number plus one to the list.

tests-split-join-sort_jl.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Patrick Cloutier avatar image Patrick Cloutier commented ·

You're a genius ! Thank a lot !!

0 Likes 0 ·