question

Karan avatar image
0 Likes"
Karan asked Karan commented

Pushing Bundled data table to a list

Hi,

I asked this question earlier and @Jason Lightfoot showed how to push a global table to a list.

Model efficiency for global table reading and creating objects - FlexSim Community

However, if the table were instead of the bundle type, the rows would not be individual nodes. In this case how could I push a bundled table to a list? Would I have to loop through each row for each table and push them individually?

FlexSim 23.2.3
bundle table
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

·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Karan commented

You could push an array variant that is the bundle node and the row and then add fields that access that using expressions. However this would not work if the table is dynamic and the list expressions are dynamic. In that case you'd need to push index values instead of the row.

· 4
5 |100000

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

Karan avatar image Karan commented ·

Thank you for the quick response. I had found the bundle node but didn't have success writing it to an array. I did the following:

Array test;
test.push(Model.find("/Tools/GlobalTables/TableName>variables/data"));
return test;

//Array[1]:[/Tools/GlobalTables/TableName>variables/data]

But this is an Array with length 1. I would rather need an Array that has each index of the bundle data node, in this case the array length would have to be 23,335 since that is the number of rows my table has.

OR: is there a way to access the index from via the path? Are you suggesting that? In which case it would have to be a loop through each index?

/Tools/GlobalTables/TableName>variables/data



0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Karan commented ·
treenode bundlnode=Model.find("/Tools/GlobalTables/TableName>variables/data");
int row=6;
List("MyList").push([[bundlenode,row]]);  //array within array

ListPushVariant.fsm

0 Likes 0 ·
listpushvariant.fsm (35.3 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦ Karan commented ·
Added a model example with expressions to access the table data. Run the script to push the data to the list.
0 Likes 0 ·
Karan avatar image Karan Jason Lightfoot ♦ commented ·
Thank you! That worked as intended.
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.