question

Adam C avatar image
0 Likes"
Adam C asked Adam C converted comment to answer

Bundle label (table) value as a list expression?

This is for a dynamic routing / job shop model. Routing data is stored to the flowitem on a bundle label, Routing. Another label, stepRow, indicates which routing is next. The stepRow label is 1 on flowitem creation to begin with the first routing, and as each routing process is complete the stepRow label is incremented. The Routing label looks like this:

Process
Process Time
200 1.5
400 .5
100 22

To push to a list with the next process as an expression, I have tried the following with some minor variations:

(1) return value.Routing[value.stepRow][1];
(2) return value.labels("Routing")[value.stepRow][1];
(3) 
Object thisItem = value.as(Object);
Table routing = thisItem.Routing.as(Table);
return routing[value.stepRow][1]; //also with .value

These give either type mismatches (value is Variant by default) or "Unknown command labels being called."

Machines in the model will pull from the list where a flowitem's next process matches its own, and will likewise get process times from the Routing label.

FlexSim 18.0.7
list fieldsbundle label
· 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.

Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Adam C,

I'm following up on our unresolved questions and found this one. I'm so sorry that it has been so long with no response from us or anyone on the community.

Were you able to solve your own question already? If so, is it something you can post below as an Answer to your own question?

If you are still looking for support on this topic, please reply back below and let us know where you are currently with this question and how we can help. A sample model can be most helpful, so if that is something you can share, please attach it to your reply.

If you're not comfortable sharing your model publicly, please consider posting a new, private question. Private questions are visible only to our main office staff, so they are a good way to get support on confidential models.

0 Likes 0 ·

1 Answer

Adam C avatar image
1 Like"
Adam C answered

I made it work by writing the value of interest on a new label and pushing that onto the list. The new code might work to pull the value directly from the bundle label to the list, but I have not tried it. List expressions do not seem to like blocks of code. The code to retrieve and write to the new label is:

item.newLabel = item.labels["Routing"].as(Table)[item.stepRow][1];

It is then pushed to the list with the expression:

value.newLabel
5 |100000

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