Deciding to Use a Calculated Attribute

Although many functions can be accomplished using a calculated attribute, it is best to carefully consider when a calculated attribute is the most efficient way to address a requirement. Because a calculated attribute is recalculated each time it is viewed in an editor, and when it is exported (unless explicitly set to not calculate), overuse can lead to system inefficiency and user dissatisfaction The type of data involved helps determine if a calculated attribute would be considered recommended practice, as defined in the sections below.

When deciding to use a calculated attribute or not, start with the following general rules:

  • Static data, such as attribute values that rarely change, seldom benefits from a calculated attribute since the result is also static.
  • Fluid data, such as referenced data where the target of the reference does change, often benefits from calculated attribute since the result is rarely the same.

Static Data Example

Consider the following five (5) attributes that are used together to create a dynamic product description: Base Description, File Cabinet Color, File Cabinet Lock, File Cabinet Material, and File Cabinet No Drawers.

In the image above, the calculated attribute (named Calculated Description) compiles each value into a single field. However, once an individual value is added for these attributes, they are not likely to change. If any one of the values did change, it would likely not be the same product. So using a calculated attribute in this case would mean that each time the data is displayed in an editor, or exported, the calculation runs but always returns the same result. Depending on the number of objects using this same calculation, the increased processing time could be significant. In this situation, it would be better to use a business rule to populate a standard specification attribute with the same information.

Fluid Data Example

Consider the following parts of a kit, where each includes product-to-product references. The requirement is to use the values on the target of the secondary reference.

In the example below, the 'Conference Room Starter Kit 1' References tab includes a reference to a single projector (with the ID JKL-5001-100) via the 'Part of a Kit' reference type. The projector, in turn, references three (3) other products via the 'Spare Part' reference type, as shown on the JKL-5001-100 References tab.

The screenshot below displays how these spare parts are displayed on the 'Conference Room Starter Kit 1' object Product tab using the calculated attribute named 'Spare Parts Calculation.'

In this scenario, the referenced objects are expected to be updated regularly as new products are added to the line. This fluid data would benefit from a calculated attribute to ensure the updates are displayed.