Skip to main content

GetEventTypeNum

Function GetEventTypeNum(const aEventTypeCode : string) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetEventTypeNum('SendPartner'); // 41
end;

Usage

GetEventTypeNum converts a Velox event type code to its canonical number.

Parameters and result

ItemTypeDescription
aEventTypeCodestring, constEvent type code. Matching is case-insensitive but otherwise exact.
ResultVariantNumeric event type for a recognized code; otherwise Null.

Complete mapping

NumberCode
0ReceiveCompany
1SendCompany
2SendUpdateCompany
3SendControlCompany
21NotifyCompany
22NotifyUpdateCompany
23NotifyIssueCompany
24NotifyErrorCompany
40ReceivePartner
41SendPartner
42SendUpdatePartner
43SendControlPartner
44SendCollectPartner
45SendDeliverPartner
61NotifyPartner
62NotifyUpdatePartner
63NotifyIssuePartner
64NotifyErrorPartner
101CreatePODPDF
102EmailPODPDF
103SendPODXML

Behaviour and edge cases

  • Matching is ordinal and case-insensitive for these ASCII codes, so sendpartner matches SendPartner.
  • The whole string must match. Leading or trailing whitespace, punctuation changes and embedded spaces return Null.
  • Empty text and numeric text such as '41' return Null; the function does not parse numeric input.
  • ReceiveCompany returns the valid number 0. Do not interpret a zero result as failure; test VarIsNull.
  • The result is an integer held in a Variant.
  • Similar-looking custom event names cannot be added through configuration.

Additional Technical Info

GetEventTypeNum converts a canonical Velox EDI event type code to its source-defined number. It recognizes the complete company, partner, notification and proof-of-delivery mapping below. The table is fixed in product source.

Implementation

The function compares the input with every source literal using Delphi SameText, in source order, and assigns the first corresponding constant. If no comparison matches, it assigns Null. It does not trim, parse a number, query the database or consult configurable event metadata.

Side effects, errors and performance

The function is pure for string input, performs no I/O and changes no state. It performs a bounded linear scan of 21 literals, which is effectively constant-time for scripting use. Unknown values return Null.

Related entries

Created 2026-07-15