question

XP Li avatar image
0 Likes"
XP Li asked XP Li commented

Pull tokens from a list to drive a process flow

In a process flow, I pushed the tokens into a list. Based on some business logic, I pull the tokens from the list. I can use token.pulled.labelName to access the pulled token. Is there a way to copy all the labels of the pulled token to the puller? Basically, the desired pseudo code would be: puller = pulled. In this way, I can use the pulled tokens to continue to]he flow instead of the puller. Is there an elegant way to archive this? Thanks.

FlexSim 22.1.2
process flow
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

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered XP Li commented

Are the tokens pulled from the same process flow they are in themselves. Because in that case you actually could just use the pulled token. Either by having the 'Push to List' activity lead to where they have to go (if the tokens are waiting there to get pulled) or by using the 'Release Token' activity to move them to somewhere else in the same process flow.

1655895845704.png

Otherwise you can use the following code in a custom code activity to copy all labels over to the puller. (code assumes the puller is the token that triggers it)

treenode labelNode = token.as(treenode).subnodes["labels"];
treenode pulledLabelNode = token.pulled.as(treenode).subnodes["labels"];

// Copy all labels from pulled to token
for(int index = 1; index <= pulledLabelNode.subnodes.length; index++)
{
    createcopy(pulledLabelNode.subnodes[index], labelNode, 1);
}

Not necessarily elegant, but should work.

CopyTokenLabels.fsm


1655895845704.png (1.9 KiB)
copytokenlabels.fsm (35.3 KiB)
· 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.

XP Li avatar image XP Li commented ·
I like the idea of "release token"! Other methods could work too but not as simple as just release the tokens from the list. Thanks!!
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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