Introduction to Value Templates

This section provides a way to understand the relationship between the attribute values, a value template, and the calculated attribute result.

Unit Considerations

In order to convert units relevant units must have a Base Conversion defined in the units area of System Setup, and the unit template field must be available when calculated attributes have a numeric validation base type.

In some of the examples below, the prodval() function includes the 'unitid'. This 'unitid' is only needed if a user wants to convert the values to a specific unit. If the unit is already the correct type of unit, there is no need to use prodval("AttributeID", "Unitid"), the user can just use prodval("AttributeID").

Attribute Values

The functions ‘prodval’ and ‘value’ act the same in retrieving the attribute values in STEP.

The examples in this section use the following set of attribute values:

Attribute

Height

Width

Length

Color Front

Color Back

Value

22 cm

39 cm

54 cm

Black

White

Example Value Templates and Results

In the table below, the Description column describes some commonly used value template types, the Value Template column lists examples that can be copied and pasted into the Function Editor, and the Results column displays the resulting calculated attribute values when the example attribute values (listed above) are used with each value template.

Description

Value Template

Results

Box Shape: Displays if the bottom of the box is square or not.

if(value('Length') = value('Width'), 'Square', 'Not Square')

Not Square

Color: Compares the front and back colors of the current product and displays the result.

if(exact(value('Color Front'), value('Color Back')),

'Same color front and back', 'Different colors front and back')

Different colors front and back

Dimensions: Displays the dimension of the current product in the form 'Height x Width x Length'

CONCATENATE(simplevalue('Height'), ' x ',simplevalue

('Width'), ' x ', simplevalue('Length'))

22 cm x 39 cm x 54 cm

Size for cabin baggage: An air carrier has a limit on the size of the cabin baggage, namely: 1) max dimension allowed is 23 x 40 x 55 cm, and 2) the sum of these must be max 115 cm.

This calculated attribute delivers the result of the calculation of size with respect to both rules.

IF (AND (OR (AND (PRODVAL ("Height", "unece.unit.CMT") <= 23,

PRODVAL ("Length", "unece.unit.CMT") <= 40,

PRODVAL ("Width", "unece.unit.CMT") <= 55),

AND (PRODVAL ("Height", "unece.unit.CMT") <= 23,

PRODVAL ("Length", "unece.unit.CMT") <= 55, PRODVAL ("Width", "unece.unit.CMT") <= 40),

AND (PRODVAL ("Height", "unece.unit.CMT") <= 40,

PRODVAL ("Length", "unece.unit.CMT") <= 55, PRODVAL ("Width", "unece.unit.CMT") <= 23),

AND (PRODVAL ("Height", "unece.unit.CMT") <= 40,

PRODVAL ("Length", "unece.unit.CMT") <= 23, PRODVAL ("Width", "unece.unit.CMT") <= 55),

AND (PRODVAL ("Height", "unece.unit.CMT") <= 55,

PRODVAL ("Length", "unece.unit.CMT") <= 23, PRODVAL ("Width", "unece.unit.CMT") <= 40),

AND (PRODVAL ("Height", "unece.unit.CMT") <= 55,

PRODVAL ("Length", "unece.unit.CMT") <= 40, PRODVAL ("Width", "unece.unit.CMT") <= 23)),

PRODVAL ("Height", "unece.unit.CMT") + PRODVAL ("Length", "unece.unit.CMT") +

PRODVAL ("Width", "unece.unit.CMT") <= 115),"Size OK for cabin baggage", "Too Big for cabin baggage")

Size OK for cabin baggage

Size for special storage: The product must have either width or length greater than 40 cm, but not both.

IF (AND (OR (PRODVAL ("Length") >40, PRODVAL ("Width") > 40),

NOT (AND (PRODVAL ("Length") > 40, PRODVAL ("Width") >40) ) ),

"OK - One and only one dimension > 40","Not OK - none or two dimensions > 40" )

OK - One and only one dimension > 40

Size for standard package: Since a delivery service charges extra for oversized packages, this could be used to determine if a dimension exceeds 40 cm.

IF (AND (PRODVAL ("Height", "unece.unit.CMT") <= 40, PRODVAL

("Width","unece.unit.CMT") <= 40, PRODVAL ("Length","unece.unit.CMT")

<= 40),"Size OK for standard package", "Too big for standard package")

Too big for standard package

Volume: Calculates and displays the volume of the current product.

prodval("Height","unece.unit.CMT") *prodval("Width",

"unece.unit.CMT") *prodval("Length","unece.unit.CMT")

Unit Template:

iterate(stepurl2objid(stepurl("Unit","unece.unit.CMQ")),'stepid()')

46332 cm3

Volume (Liter): Calculates the volume in Liter and displays with one decimal.

text(prodval("Height","unece.unit.CMT")

*prodval("Width","unece.unit.CMT")

*prodval("Length","unece.unit.CMT")/1000,"0.0")

46.3