question

Marc R5 avatar image
0 Likes"
Marc R5 asked Marc R5 commented

add a new column when pushing a value to a list

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[i];

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

}


Thanks!

FlexSim 22.0.2
custom codepush to list
5 |100000

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

1 Answer

·
Regan Blackett avatar image
0 Likes"
Regan Blackett answered Marc R5 commented

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.

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

Marc R5 avatar image Marc R5 commented ·
That's perfect. Thank you very much
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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