When you are writing code that requires that you traverse hierarchical business objects, you need to use the syntax that lets you specify attributes in elements in child business object arrays that are elements of child business object arrays, and other such complexities. This chapter specifies the syntax to use.
An attribute specification can be:
[[attributeName[index].]...]attributeName
This syntax expands to any of the following formats:
attributeName attributeName[index].attributeName attributeName[index]... .attributeName
The following example uses the busObj.get() method to retrieve a basic type attribute named OrderID from the business object orderObj.
orderObj.get("OrderID");
The following example assumes that orderObj is a hierarchical business object. One of its attributes is CustomerInfo, a single-cardinality child business object. The example retrieves the customer name from the CustomerName attribute of CustomerInfo.
orderObj.get("CustomerInfo.CustomerName");
If there is a chain of child business objects, in which CustomerInfo is a child of orderObj and AddressInfo is a child of CustomerInfo, you can retrieve city information from AddressInfo as follows:
orderObj.get("CustomerInfo.AddressInfo.City");
You can also refer to a child business object in an array by specifying its index in the array. The first element in the array always begins with zero. For example, the following example retrieves the value of the Quantity attribute from the third child business object in an array.
orderObj.get("LineItem[2].Quantity");