Skip to main content

GetOrderTypeCode

Function GetOrderTypeCode(const aOrderType : Variant) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetOrderTypeCode(1); // 'SalesOrder'
end;

Usage

GetOrderTypeCode converts a Velox order type number to its canonical code.

Parameters and result

ItemTypeDescription
aOrderTypeVariant, constNumeric order type. 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
1SalesOrder
2PurchaseOrder
3PickLoadOut
4ReceiptLoadIn

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

GetOrderTypeCode converts a numeric order type 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 aOrderType = 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