Skip to main content

GetSourceNum

Function GetSourceNum(const aSourceCode : string) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetSourceNum('App'); // 1
end;

Usage

Parameters and result

ItemTypeDescription
aSourceCodestring, constsource code; matching is case-insensitive but otherwise exact.
ResultVariantMapped integer for a recognized value; otherwise Null.

Complete mapping

NumberCode
1App
2EDI
3Web
4API

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 VarIsNull before assigning to a non-nullable numeric target.
  • Source 1/App is the only value that IsSourceInternal treats as internal. IsSourcePartner deliberately treats every other integer—including invalid values—as partner.
  • These codes describe origin; they do not authenticate a caller, validate a channel or prove that data actually arrived through that source.

Additional Technical Info

GetSourceNum converts a source 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

Created 2026-07-15