how can I query a token in an activity

joerg_vogel
Not applicable
1 View
1 Reply
Message 1 of 2

how can I query a token in an activity

joerg_vogel
Not applicable

[ FlexSim 17.2.3 ]

I'd like to preempt a token from a delay activity. Before I can do this I have to identify this token. Is there a method like querying a flowitem in a queue. It is described in the manual: SQL Queries "Advanced Query Techniques".

9929-query-token-in-activity.jpg

identify-token-in-activity.fsm

Accepted solutions (1)
2 Views
1 Reply
Reply (1)
Message 2 of 2

raja_sekaran
Not applicable
Accepted solution

@Jörg Vogel

You can do this using List. I have attached the sample models.

Using below code to push the tokens from the "Delay" activity to the list. Then use Query in a Pull from activity in order to identify the token.

string name = "Delay";
int flags = 0;
Array tokens = gettokens(current, getactivity(processFlow, name), flags);
for (int i = 1; i <= tokens.length; i++) 
{
Token otherToken = tokens;
List("List1").push(otherToken);
}

In the second attached model, I have added one more label named "preempted" and assign "0" as a value to the token. There is a possibility to select the same token again for preemption that's why I have added this and change that value to "1" once it is preempted also set different color to the preempted token.

I hope this helps you.

Thanks.

query-token-preemption-3.fsm

query-token-preemption-4.fsm