question

mary avatar image
0 Likes"
mary asked Jason Lightfoot commented

Pull item based on object assigned label

Hi I have a model where I am creating a label "a" in my processor1. whenever part a enter it has label ID1 the same should be assigned to the label present in Processor as "ID1" that I'm creating in process flow. next there are two buffer it should pull the parts with referring to label present in Processor i.e, "a" . If "a" has "ID1" pull to Queue1 and if "a" has "ID2" pull to Queue2.


sample1.fsm

FlexSim 20.0.10
labelobject
sample1.fsm (31.3 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.

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot commented

The process flow in your model is doing nothing as far as I can tell - and even if you put ID1 and ID2 on the items (which your process flow needs) the effect is to acheive nothing.

Put the ID1 and ID2 labels on your items and have the queues pull those IDs under the pull requirement.

What you have is overcomplicated for what you seem to be trying to do.

· 6
5 |100000

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

mary avatar image mary commented ·
@Jason Lightfoot I know but this model just for understanding. I have other model where I am using this method it's different I wanted to know how can I use that label to pull item. The answer given by @Jacob W2 it pulls ID value even it is not assigned any I want to pull only assigned ID item.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ mary commented ·

When you pull you refer to an item. You are changing the label on a processor. Your pull requirement would be item.up.a=="ID1". Why do that when you can just inspect the items value?

0 Likes 0 ·
mary avatar image mary Jason Lightfoot ♦♦ commented ·
@Jason Lightfoot Please Can you make the changes to my model that your telling me.
0 Likes 0 ·
Show more comments
Jacob W2 avatar image
0 Likes"
Jacob W2 answered Jason Lightfoot commented

Hi @mary,

If you want to have the value of the label "a" on your processor change based on the item ID label, you can add an on entry trigger that updates the label value on your processor to be the value of items ID label.

on-entry.jpg

With how you have set up your model, instead of having your queues pull the items, you can instead have the processor send the items to the correct queue. I wrote a small bit of code that checks the value of "a" and then sent the item to either port 1 or 2.

if (current.a == "ID1"){
return 1;
}
else if (current.a == "ID2"){
return 2;
}

If you wanted to have the items pushed to a list and then have the queues pull each item based on their ID label, it would be easier to just use the item ID and not worry about using a label on the processor. That could be done by adding a label field on the List called ID, and then adding a query that pulls items WHERE ID = "IDValue".


on-entry.jpg (9.9 KiB)
· 2
5 |100000

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

mary avatar image mary commented ·
Thank you @Jacob W2 I know i can directly use ID assigned to item but there is other model I am trying were i need this condition. the code you have given is working but what i want if both this condition is not true it should stop sending item.
0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ mary commented ·
If you need to control the release of the item there are many ways to do that- with port closure, or by choosing "do not release" in the send to port and have a process flow release the item.
0 Likes 0 ·