Units Scenario

A calculated attribute can show multiple unit values using a single unit of measure. In this example, a product has several attributes with units, but the values entered are not using the same unit, the values of attributes height, length, and width have valid unit types of MM and CM.

Prerequisites

For more information on units, refer to the Units topic in the Getting Started documentation here.

Approach

The units will need to be configured for conversion, and then the required display unit will need to be specified for the results.

Configure Units for Conversion

Using an appropriate conversion formula to associate multiple units allows the calculated attribute to make the conversions as needed. For example, meters can be converted to millimeters and centimeter as shown below.

Concatenate and Specify Required Unit

Different units were selected while adding values for the height, length, and width attributes.

The calculated attribute value template can specify the required display unit for the result. In the following value template, notice that the centimeter unit is applied to each attribute value. It also concatenates each of the values and separates them with 'x' (static text).

Note: To verify the value template formula is correct, use Evaluation Node to select an object with values in the attributes and click the Evaluate button. The result is displayed in the bottom text box.

Value Template

The following text was added to the value template:

concatenate (prodval("Height","unece.unit.CMT")," x ",
prodval("Width","unece.unit.CMT")," x ",
prodval("Length","unece.unit.CMT"))

Note that the value entered as 255 mm was converted to 25.5 cm, using the Base Unit conversion formula.