question

yuan zhang avatar image
0 Likes"
yuan zhang asked yuan zhang commented

Create label table as bundle

Dear all,

I would like to create a label table(bundle), used the following code.

Table nn = so().labels.assert("PickParameter");
nodeadddata(nn,DATATYPE_BUNDLE); 
nn.setSize(1,2,DATATYPE_STRING);
nn.setSize(1,5,DATATYPE_NUMBER);
nn.setSize(1,8,DATATYPE_STRING); 
nn.setColHeader(1,"TSnum"); 
nn.setColHeader(2,"LoadStation"); 
......

While execute the script, the system console shows error message :exception: FlexScript exception: Invalid column number: 1 in MODEL:/Processor1>labels/PickParameter at /0 c: /testlink_instance i: /testlink_associated】

If I cancel setColHeader or nodeadddata,there is no error.

Is there any limitations when using dot syntax(like setColHeader)?

Thanks!

FlexSim 17.1.2
create label table as bundle
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 yuan zhang commented

Unfortunately you can't rename columns in a bundle. This is just a limitation of bundles. Instead of using the setSize method, you'll need to use the bundle commands.

addbundlefield(nn, "String", BUNDLE_FIELD_TYPE_STR);
addbundlefield(nn, "Number", BUNDLE_FIELD_TYPE_FLOAT);

If you call this code more than once on the same node, you'll need to add a check to see if the bundle has already been created. If it has been created, then you don't need to call the addbundlefield commands again.

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

yuan zhang avatar image yuan zhang commented ·

Hi Matt,Thanks a lot!

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.