question

Tomi Kosunen avatar image
1 Like"
Tomi Kosunen asked Jason Lightfoot edited

Release after split

How can I release the acquired resource if the token is split into two tokens in the example model (attached)? In the example model the token is Split and the release is connected to out 2. I know that the model works if Release is connected to out 1, but I'd like to understand the release method. It has something to do with the Resource in Process Flow that is not copied to the token2 (all the labels are copied).

split-release.fsm

process flow
split-release.fsm (30.4 KiB)
5 |100000

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

1 Answer

Braydn T avatar image
1 Like"
Braydn T answered Jason Lightfoot edited
@tomi.kosunen

I added a couple of other things in this example so you can see what is going on a little clearer:

split-release-ex.fsm

First click on the split box. You will notice the branch on the right is the first branch. Since you have chosen the option to make the split create independent tokens, the acquired resource will go down branch one. If you step through the model as is, and click on the tokens when they are in the Custom Code box you will notice that the tokens that go down Branch 1 will always keep the acquired resource. All you need is a release resource on the first branch, and it will release the token.


· 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.

Tomi Kosunen avatar image Tomi Kosunen commented ·

Thanks for the answer. But if I want the token on the second branch to release the acquired resource. How do I do that?

It is not very intuitive if I have to keep in mind in which branch did I put which token -> which token can release the resource and which cannot.

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

Unfortunately you have to keep this sort of thing in mind. There are a few options though:

  1. Change the connector rank so the original token leaves out the second connector.
  2. Change the Split so that it creates a Child token with the Label Access on Parent only option checkes (this will allow either token to release the resource, but now the second token can't have its own labels and is just a proxy of the first token)
  3. Put a reference to the first token on the second token (for example token.OtherToken) and then when you want the second token to release the resource type out token.OtherToken.labels["resource"] (where "resource" is the label name where the resource was assigned to on the first token)
1 Like 1 ·
Tomi Kosunen avatar image Tomi Kosunen Matthew Gillespie ♦♦ commented ·

Thanks, now it works.

0 Likes 0 ·
Show more comments
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Tomi Kosunen commented ·

Carefully consider if you really need to acquire a resource or whether you're just using it to get references to dispatcher/task executer. Often the default task sequence logic on dispatchers will handle exclusivity for you, and the restriction by an extra resource can overcomplicate models when you try do handle the tasks in a flexible way.

0 Likes 0 ·