GetOrderTypeForASNType
Function GetOrderTypeForASNType(const aASNTypeCode : string) : Variant;
Example
procedure ScriptEvent(var Value: variant);
begin
Value := GetOrderTypeForASNType('CustomerASN'); // 'SalesOrder'
end;
Usage
GetOrderTypeForASNType maps a Velox ASN type code to its corresponding order type code.
Parameters and result
| Item | Type | Description |
|---|---|---|
aASNTypeCode | string, const | Canonical ASN type code. Matching is case-insensitive but otherwise exact. |
| Result | Variant | Order type code string for a recognized input, otherwise Null. |
Behaviour and edge cases
- Customer versus supplier direction selects SalesOrder versus PurchaseOrder.
- Matching ignores ASCII letter case but does not trim. Whitespace, punctuation differences, empty text and unknown/custom type codes return
Null. - The function recognizes source-family codes only. Passing
SalesOrder,PurchaseOrderor numeric text is not an identity conversion and returnsNull. - The result describes type/direction only; it does not copy, create, validate or change an order.
- The mapping is not extensible through customer configuration.
- Test
VarIsNullbefore treating the result as a valid order type.
Additional Technical Info
GetOrderTypeForASNType converts a ASN type code into the canonical order type code that represents the same customer/supplier direction. It is a compiled business mapping; it does not inspect a document, order record, trading party or database configuration.
Complete transformation
| Input ASN type code | Order type code | Order type number |
|---|---|---|
CustomerASN | SalesOrder | 1 |
SupplierASN | PurchaseOrder | 2 |
Implementation
The function tests each supported input with installed Delphi SameText. It returns the literal Type_SalesOrder_String or Type_PurchaseOrder_String value. The final branch returns Null. There is no intermediate call to another public conversion function.
Side effects, errors and performance
The function is pure, performs no I/O and runs over a small fixed comparison chain. Ordinary unmatched string input returns Null.
Related entries
GetOrderTypeNumForASNTypereturns the same directional mapping as a number.GetASNTypeCodedocuments the reciprocal ASN type number/code domain accepted here.GetOrderTypeCodeandGetOrderTypeNumconvert within the output order-type domain.- Embarcadero:
System.SysUtils.SameText - Free Pascal:
SameText