Skip to main content

GetPartyTypeCode

Function GetPartyTypeCode(const aPartyType : Variant) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetPartyTypeCode(1); // 'Customer'
end;

Usage

GetPartyTypeCode converts a Velox party type number to its canonical code.

Parameters and result

ItemTypeDescription
aPartyTypeVariant, constNumeric party 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
1Customer
2Supplier
3Consignor
4Consignee
5Location
6Carrier
7Shipper
8Agent
100Company

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.
  • Company is deliberately 100, not the next value after Agent. Do not infer party numbers by list position.
  • GetReferenceTableForPartyType returns a different, prefixed identifier family and uses Unknown rather than Null for a miss.

Additional Technical Info

GetPartyTypeCode converts a numeric party 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 aPartyType = 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