question

Oscar C13 avatar image
0 Likes"
Oscar C13 asked Felix Möhlmann commented

Load non-group items

Hello,
My question is related to https://answers.flexsim.com/questions/110158/load-all-items-from-queue.html

Imagine that you want to take all the elements of the queue, but removing those items that belong a group or a table. That it, in the attached model i want to take all the items except "tubo" and "tubo2". but whithout indicating that they are the ones that I don´t want to take exactly.
I would like to tell the program to take those items that don´t belong to the group "x" or those that don´t appear in the table "x" or that don´t belong to a list. I don´t know which is the best method.
I have explained?

I want to do this because in my model what is going to be in queue will depend on other factors. So I want to be able to make distinction between what I am interested in getting and what I am not.

lavar-1.fsm

FlexSim 21.2.1
processflowqueuegroups
lavar-1.fsm (37.9 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

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

All three suggestions are possible (List, Group, Table). The group is probably the least suited. since it's normally used as a fixed collection object, there are no pre-defined options to add and remove members and you'd have to use custom code to do that.

Lists would be the best in my opinion, since removing a row with a specific entry requires some custom code as well. (Table.deleteRow() with the command to find a row by key (see further below) as argument)

If you use a list, you'd "try" to pull the specific item from it, by referencing it in the query field of a "Pull from List" activity. Checking "Leave Entries On List" means the item will remain on the list, so it can be found by further attempts as well. Finally, activating the "Use Max Wait Timer" option allows the token to leave the activity through a different connector if it couldn't pull the item successfully.

For groups and tables you'd use a "Decide" activity set to conditional decide with the following commands.

Group:

Group("Groupname").isMember(Object)

Table:

Table("Tablename").getRowByKey(Object, col)  
// "col" is column in which the object reference would be written

All three options are demonstrated in the attached model.

lavar-1.1.fsm


lavar-11.fsm (44.6 KiB)
· 4
5 |100000

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

Oscar C13 avatar image Oscar C13 commented ·

Thanks, but I have doubts

I don´t understand how the list works in this case. I think what it does is look to see if the item is in the list. I it is, it does not take ir and if it is does take it. But, why does it do that?

1634813108304.png

In query you look for token.item, but in the push to list you didn´t put token.item

0 Likes 0 ·
1634813108304.png (26.4 KiB)
Felix Möhlmann avatar image Felix Möhlmann Oscar C13 commented ·

In the "On Wait Timer Fired" I release the token to connector 2, which leads into the "Load" activity. If the item could be found on the list, the wait timer wouldn't fire and the token instead gets released through the connector of rank 1, bypassing the loading.

1634815262062.png

"token.item" references a specific item in the queue. The label gets assigned in the "Run Sub Flow" activity. Instead of running the tokens one at a time and always taking the first item in the queue, they are now created all at once. Each one is assigned a different item in the queue via the "creationRank" parameter, since each item needs to be checked. (I actually posted a model in which the run sub flow is not configured correctly yet, sorry. I'll attach an updated file. The old one will not work if the items that should stay in the queue are not created last.)

In the "Pull from List" I want to check whether that specific item is part of the list, so the query is for the object referenced in "token.item".

lavar-1.2.fsm

0 Likes 0 ·
1634815262062.png (7.2 KiB)
lavar-12.fsm (44.5 KiB)
Oscar C13 avatar image Oscar C13 Felix Möhlmann commented ·

And if the items weren´t created in the queue? but have been brhought there?

Then, you couldn´t use [creationRank]. How would it be done then?

0 Likes 0 ·
Show more comments

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.