question

Legit avatar image
0 Likes"
Legit asked Legit commented

Retrieving item information from item list through custom code (pull from list)

Hello, I have a custom code that essentially should do the same thing as the "pull from list" function in the ProcessFlow.

code.png

However, I have the following problem. "Pull from list" adds a label named "pull" to the token by default, and its value is an information about a single item or the location of the item, for example: "/Rack1/Box3".

pull1.png

In the ItemList, this information is always stored in the first column labeled "value". My problem is that with my custom code, I can only retrieve values from the columns Type, age, distance, and queueSize.

list.png

However, I don't know how to get the information from the "value" column. I tried pullResult.value.value but it obviously didnt work. I also cant find the "value" column in the proberties of the global list/ item list. So far, in my code, the value from the Type column is queried, but it should actually be the information from the "value" column (for example: /Rack1/Box3).

Does anyone know how to modify the code to retrieve this information from the list and assign it as a label? Alternatively, is there a way to add another column to the list containing the same information? I have also attached a model, with my code and the default "pull from list".model-1.fsm

FlexSim 23.2.1
pull from listlabelcustom codelabel value
pull1.png (24.5 KiB)
code.png (21.4 KiB)
list.png (10.9 KiB)
model-1.fsm (52.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.

Kavika F avatar image
0 Likes"
Kavika F answered Legit commented

@Legit, to get the value of a List.PullResult, you do

List.PullResult result = List("ItemList1").pull(...) // Example code
Variant box = result.value;

You're trying to get the value of the value, but all you need is the original value.

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

Legit avatar image Legit commented ·
Thank you very much :)
0 Likes 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered

The pullResult1 is the box.

The Type can be assigned with :

token.Type=pullResult1.Type;
5 |100000

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