question

Joerg Vogel avatar image
1 Like"
Joerg Vogel asked Raja Sekaran edited

how can I query a token in an activity

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

identify-token-in-activity.fsm

FlexSim 17.2.3
process flowquerysqlquery an activity content
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

·
Raja Sekaran avatar image
4 Likes"
Raja Sekaran answered Raja Sekaran edited

@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[i];
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


5 |100000

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

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.