question

Lucas Delago avatar image
0 Likes"
Lucas Delago asked Matt Long answered

How to get access to a bundle label?

For arrays labels I can use Processor.Labelname[position], but the same logic doesn’t work with bundle labels. I already tried the Table command, but didn’t get any success.

Of course, I can use the old commands to manipulate the bundle data, but I seeking for a simple way.

FlexSim 17.1.2
labelslabeldot syntaxbundlebundle label
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

Matt Long avatar image
3 Likes"
Matt Long answered Joerg Vogel commented

You can't use the same code as array labels because bundles don't have labels. They behave more like tables, so yes you can use the Table API to get and set data on a bundle.

If you have a node in the Tools folder with bundle data on it, you can access a value on that bundle using something like the following:

Table bundle = model().find("Tools/Bundle"); //Casts the bundle data to a Table
double value = bundle[1][2]; //Row 1, column 2
string strValue = bundle[2][1]; //Row 2, column 1

To set the data on a bundle, use the same syntax:

bundle[1][2] = 5.34;
bundle[1][2] = "My String";

You can also access columns by their names:

double value = bundle[1]["Col 1"];
bundle[1]["Col 1"] = 35.4;

If you want to put it all into one line, it would look like this:

model().find("Tools/Bundle").as(Table)[1][2] = 35.2;
double value = model().find("Tools/Bundle").as(Table)[1][2];

Keep in mind that when using the Table API, the data is one based, not 0 based as was the old bundle commands.

5 |100000

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