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

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

Legit
Not applicable
103 Views
3 Replies
Message 1 of 4

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

Legit
Not applicable

[ FlexSim 23.2.1 ]

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

0 Likes
Accepted solutions (1)
104 Views
3 Replies
Replies (3)
Message 2 of 4

jason_lightfootVL7B4
Autodesk
Autodesk

The pullResult1 is the box.

The Type can be assigned with :

token.Type=pullResult1.Type;
0 Likes
Message 3 of 4

kavika_faleumu
Autodesk
Autodesk
Accepted solution

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

0 Likes
Message 4 of 4

Legit
Not applicable
Thank you very much :)
0 Likes