Skip to main content

GetOrderStatusCode

Function GetOrderStatusCode(const aOrderStatus : Variant) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetOrderStatusCode(1); // 'Ordered'
end;

Usage

GetOrderStatusCode converts a Velox order status number to its canonical code.

Parameters and result

ItemTypeDescription
aOrderStatusVariant, constNumeric order status. Supply one of the listed integral values in a compatible Variant.
ResultVariantCanonical code string in a Variant, or Null for a null or unrecognized value.

Complete mapping

NumberCode
1Ordered
2Responded
3Changed
4Confirmed
5Delivered
6Invoiced
7Cancelled

Behaviour and edge cases

  • With Velox's default loose NullEqualityRule, Null follows the explicit null branch. The rule is shared across the Velox process; strict or error settings can alter or break that comparison.
  • Unknown comparable values return Null; they do not raise a domain-specific error.
  • Use the listed integral values. Do not rely on Variant coercion from strings, floating-point values or booleans.
  • Arrays, interfaces and other incompatible Variant values can raise comparison or ordinal-conversion errors, which propagate.
  • Identical numbers or labels used by another status/type family do not make the domains interchangeable. Use the function for the field's actual semantic family.

Additional Technical Info

GetOrderStatusCode converts a numeric order status to the canonical Velox code. Its complete mapping is compiled into the product and is not read from customer configuration.

Implementation

The source first evaluates aOrderStatus = Null, then uses a case over the listed constants. A recognized value returns its literal code and the else branch returns Null. It performs no database query or configurable alias lookup.

Side effects, errors and performance

For supported input the function is pure, performs no I/O and runs over a small fixed mapping. Variant comparison/conversion failures propagate.

Related entries

Created 2026-07-15