Open topic with navigation

TIBCO Business Studio™ - BPM Edition 5.4.0

# Multiple Instances of a BOM Class in a BOM Class Attribute

Just as we defined Process Fields that contained Multiple Instances of Customer Business Objects in the previous section, we can also specify that an attribute of a BOM Class can have and must have multiple instances, for example, an Order might contain multiple OrderLine objects.

In BOM Editor, this is configured by setting the multiplicity of the attribute, as shown here:

The above screen capture shows some example values that can be used to specify the multiplicity, however, other values can also be used, for example, 3..6 would mean between 3 and 6 instances must be added to the field.

If the multiplicity is greater than one (e.g. "*"; "1..*" or "3..6"), an Array is used to manage the field, and values must be added to the field using Arrays. Otherwise, if the multiplicity is 1 (for example, multiplicity is "1" or "0..1"), a straightforward assignment can be used.

When the multiplicity of an attribute is greater than one, an Array is used to manage the data at runtime, in the same way Process Fields are managed when the Array check box is set in the Field Properties. To manage the multiple orderlines associated with an Order, the following script can be written.

    var orderline = data.com_example_data_createOrderLine();
    orderline.partNumber = 10023;
    orderline.quantity = 3;
    data.order.orderlines.push(orderline);
    orderline = factory.com_example_data_createOrderLine();
    orderline.partNumber = 10056;
    orderline.quantity = 1;
    data.order.orderlines.push(orderline);

or using the `bpm.scriptUtil.copy()` method:

    var orderline = factory.com_example_data_Factory.createOrderLine();
    orderline.partNumber = 10023;
    orderline.quantity = 3;
    data.order.orderlines.push(orderline);
    orderline = bpm.scriptUtil.copy(orderline);
    orderline.partNumber = 10056;
    orderline.quantity = 1;
    data.order.orderlines.push(orderline);

Arrays provide methods for finding out how many items there are in the array, accessing particular entries in the array, and enumerating the array.

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO Business Studio™ - BPM Edition

Copyright © 2015-2023. Cloud Software Group, Inc. All Rights Reserved.