For example, many different Assembly objects might use a Component object. The cost for installing the component into each assembly might differ considerably. Therefore, you could define an attribute called “Installation Cost” and associate it with the component relationship. Whenever a connection is made between a Component object and an Assembly object, the user can insert the cost associated with that connection. Attributes can also be used in other relationship definitions or type definitions. Therefore, it is possible for the attribute to be contained within the object itself. As another example, a Quantity attribute is assigned to an assembly object to track the number of components used. You also can assign the Quantity attribute to a relationship to track the number of times the component is required for an Assembly. Since the quantity of the component could differ from assembly to assembly, the relationship records the amount as part of its definition. When a specific Component object is connected to a particular Assembly object, the user automatically has a means of inserting the quantity information. An Add Relationship command can have many or no Attribute clauses depending on the types of objects being connected and why. For example, the following command associates three attributes with the relationship named “Assembly Relationship”:
Once this command is processed and the relationship is defined, you can create connections between instances of Component type objects and instances of Assembly type objects by using the Connect Businessobject command (as described in MQL Concepts: Making Connections Between Business Objects). These connections have three fields where the user can define the values for the attributes: Quantity, Units, and Installation Cost. Although the user is not required to enter values for the attributes, they are always available. If you add an attribute that is part of an index, the index is disabled. For more information, see MQL Concepts: Indexes. |