GetShipmentStatusNum
Function GetShipmentStatusNum(const aShipmentStatusCode : string) : Variant;
Example
procedure ScriptEvent(var Value: variant);
begin
Value := GetShipmentStatusNum('Draft'); // 1
end;
Usage
GetShipmentStatusNum converts a Velox shipment status code to its canonical number.
Parameters and result
| Item | Type | Description |
|---|---|---|
aShipmentStatusCode | string, const | shipment status code; matching is case-insensitive but otherwise exact. |
| Result | Variant | Mapped integer for a recognized value; otherwise Null. |
Complete mapping
| Number | Code |
|---|---|
1 | Draft |
2 | Booked |
3 | Planned |
4 | Collected |
5 | Problem |
6 | Delivered |
7 | Cancelled |
Behaviour and edge cases
- Matching is ordinal and case-insensitive for these ASCII codes, but the entire string must match.
- The function does not trim. Whitespace, punctuation changes, empty input and unknown text return
Null. - Numeric text is not parsed. Test
VarIsNullbefore assigning to a non-nullable numeric target. - Reused labels or numbers in another Velox status/type family are not semantically interchangeable. Use the function matching the field.
Additional Technical Info
GetShipmentStatusNum converts a shipment status code to its corresponding Velox number. The complete map is compiled into product source and is not read from customer configuration.
Implementation
The source compares the input with each literal through installed Delphi SameText, in table order. A recognized branch returns its fixed counterpart; the fallback returns Null. No database or alias configuration is consulted.
Side effects, errors and performance
For supported input the function is pure, does no I/O and runs over a small fixed mapping. Ordinary unknown string input returns Null.
Related entries
GetShipmentStatusCodeperforms the reverse conversion.- Embarcadero:
System.SysUtils.SameText - Free Pascal:
SameText