Referencing objects in group in subflow

Referencing objects in group in subflow

marianuskick
Participant Participant
135 Views
7 Replies
Message 1 of 8

Referencing objects in group in subflow

marianuskick
Participant
Participant

[ FlexSim 23.2.3 ]

I have a token with a label 'Group' referencing a specific group e.g. "Group1". Now I want to execute a subflow in which I create a token for each object within the group. Each of those tokens should carry a label 'Object' with a reference to a object in the group.

1. If I use token.Group.subnodes.length as Quantity in the Create Tokens activity I get a token for each object but one additional parent token for which I don't have any use. Is there a way not to carry the parent token through the subflow?

2. Object label

2.1 In another project I used Group("Group1") but token.Group does not seem to work. What's the right way to reference?

2.2 How do I defined the index 'x' in the correct way? In the other project I used [tokenIndex] but this seems to be a global index and not a 1,2,3,.. for each new set of tokens in the subflow.

0 Likes
Accepted solutions (1)
136 Views
7 Replies
Replies (7)
Message 2 of 8

sebastian_canas9DYX7
Collaborator
Collaborator
Accepted solution

Hi @Manus K ,
Assuming you have the reference for the group in a label Group, you could set the Run Sub Flow as the image below:

Perhaps you missed the expression creationRank that returns a numeric value. Here there is a short explanation:

When the [creationRank] part of the expression is evaluated for the first created child token, the creationRank will have a value of 1. When it is evaluated for the second created child token, creationRank will have a value of 2, and so forth.

Message 3 of 8

sebastian_canas9DYX7
Collaborator
Collaborator
@Manus K ,

Could you please upload your model or a demo of the logic you built?

0 Likes
Message 4 of 8

marianuskick
Participant
Participant
0 Likes
Message 5 of 8

marianuskick
Participant
Participant

Thanks, Sebastian.

For the quantity I'm using token.Group.subnodes.length which seems to work.

The creationRank sounds super useful but I am unable to access the object with token.Group even if I used token.Group[1] for testing purposes. token.Group.subnodes also doesn't work.

0 Likes
Message 6 of 8

sebastian_canas9DYX7
Collaborator
Collaborator

@Manus K ,

First, you have an exception because you where using a bad reference in the Delay activities. You were using tokenIndex to reference the row of a Global Table. I created a label called Index in the source, so that you can use token.Index in the delay to reference the row.

Then, I am not sure why the expression I showed you before wasn't working, but I managed to make it worked downcasting the expression to Group as you see here:

Hope this helps! Sorry I cannot send a model back, but I do not have the version you use, hope the screenshots are enough

0 Likes
Message 7 of 8

marianuskick
Participant
Participant

Thank you! That's working just fine!

What's the reason behind tokenIndex not working? Does that only work directly in activities?

0 Likes
Message 8 of 8

sebastian_canas9DYX7
Collaborator
Collaborator
@Manus K ,

As far as I know tokenIndex is an expression that only works in Schedule Source and from 23.2 or 24.0 (don't remember well) in Date-Time Source as well. If you try to use it in any other Process Flow activity it won't work.