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
| Item | Type | Description |
|---|---|---|
aPartyType | Variant, const | Numeric party type. Supply one of the listed integral values in a compatible Variant. |
| Result | Variant | Canonical code string in a Variant, or Null for a null or unrecognized value. |
Complete mapping
| Number | Code |
|---|---|
1 | Customer |
2 | Supplier |
3 | Consignor |
4 | Consignee |
5 | Location |
6 | Carrier |
7 | Shipper |
8 | Agent |
100 | Company |
Behaviour and edge cases
- With Velox's default loose
NullEqualityRule,Nullfollows 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.
Companyis deliberately100, not the next value afterAgent. Do not infer party numbers by list position.GetReferenceTableForPartyTypereturns a different, prefixed identifier family and usesUnknownrather thanNullfor 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
GetPartyTypeNumperforms the reverse conversion.- Embarcadero:
System.Variants.NullEqualityRule - Free Pascal:
NullEqualityRule