GetASNStatusCode
Function GetASNStatusCode(const aASNStatus : Variant) : Variant;
Example
procedure ScriptEvent(var Value: variant);
begin
Value := GetASNStatusCode(1); // 'Delivered'
end;
Usage
GetASNStatusCode converts a Velox ASN status number to its canonical code.
Parameters and result
| Item | Type | Description |
|---|---|---|
aASNStatus | Variant, const | Numeric ASN status value. Velox expects one of the listed integral values in a compatible Variant. |
| Result | Variant | Canonical code string in a Variant, or Null when the value is null or unrecognized. |
Mapping
| Number | Code |
|---|---|
1 | Delivered |
2 | Updated |
3 | Cancelled |
Additional Technical Info
GetASNStatusCode converts the numeric representation of a ASN status to the canonical code used by Velox. The mapping is hard-coded in product source, so it is deterministic and does not read customer configuration.
Implementation
The implementation first evaluates aASNStatus = Null, then uses a case statement for the listed integral constants. A recognized value assigns the literal code; the else branch assigns Null. No database, configuration table or locale-dependent lookup is involved.
Behaviour and edge cases
- With Delphi's default loose
NullEqualityRule, aNullinput follows the explicit null branch and returnsNull. That rule is process-global; changing it to strict or error semantics can alter or break the comparison before thecasestatement. - The intended inputs are the integral values in the table. Numeric-looking strings, floating-point values, booleans and other coercible
Varianttypes should not be used as substitutes even where Delphi happens to convert them. - Unknown values return
Null; they do not raise a domain-specific "unknown ASN status" exception. - Incompatible
Variantvalues, such as arrays or interface values, can fail during comparison or ordinal conversion and propagate a Delphi conversion/operator exception. - The numeric values belong to this mapping family. A number used by another Velox type or status is not semantically interchangeable.
Side effects, errors and performance
The function is pure for normal supported values: it performs no I/O, changes no Velox state and allocates no persistent resource. It runs in constant time over a small fixed mapping. Delphi Variant comparison or conversion errors propagate; the function does not catch them.
Related entries
GetASNStatusNumperforms the reverse conversion.- Embarcadero:
System.Variants.NullEqualityRule - Free Pascal:
NullEqualityRule