Null Values in Sorting Rules

For standard attributes, null values are handled identically for all data types in B2C Commerce. For dynamic attributes, configure whether you want a null value to be interpreted as a minimum, maximum, or average value using the dynamic attribute Default Value option.

Standard Attributes

If a sorting rule is based on a standard attribute, then null values are always added to the end of the result set, independent of the sorting direction.

Ascending values sort as:

1

2

3

null

null

Descending values sort as:

3

2

1

null

null

Dynamic Attributes

To control how null values are sorted in dynamic attributes, set the Default Value for the attribute.

  • Minimum

    Null values sort to the end of the result set, similar to the default behavior for standard attributes.

  • Average

    Null values sort to the middle of the result set, as though the value was the average of all values. This is useful if you have incomplete data for some products, but don’t want a null value to automatically cause the product to be sorted to the end of the result set.

  • Maximum

    Null values sort to the beginning of the result set. This is useful if you have new products with incomplete data, such as sales figures, that you want to promote