add a new column when pushing a value to a list

add a new column when pushing a value to a list

marc_r5
Not applicable
18 Views
2 Replies
Message 1 of 3

add a new column when pushing a value to a list

marc_r5
Not applicable

[ FlexSim 22.0.2 ]

Hello!

I am using this custom code to push a set of objects inside another object to a list:

Before pushing the object to the list, is not possible to add a value in another new column based on some criteria?

For example, when passing the value, I would want another column with the creationRank, meaning I could use the "i" value in the loop in this new column I would create.


Object current = param(1);

treenode activity = param(2);

Token token = param(3);

treenode processFlow = ownerobject(activity);

for (int i = 1; i<=token.rack.subnodes.length; i++ )

{

Object inv = token.rack.subnodes;

List("PanelsInRack_ToBeManufactured").push(inv,token.rack);

}


Thanks!

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

regan_blackett
Autodesk
Autodesk
Accepted solution

It sounds like you want the "i" value to be a Field (column) on the list. The easiest way to do that would be to go to first assign the "i" value as a label to your "inv" objects. Add another line below the variable declaration like inv.CreationRank = i; This will add the label CreationRank to your "inv" objects.

Then you can go to the List properties and add a Label field that looks for the CreationRank label and see their i value on the list's entries table.

0 Likes
Message 3 of 3

marc_r5
Not applicable
That's perfect. Thank you very much
0 Likes