Skip to main content

GetUomTypeNum

Function GetUomTypeNum(const aUomTypeCode : string) : Variant;

Example

procedure ScriptEvent(var Value: variant);
begin
Value := GetUomTypeNum('Unit'); // 1
end;

Usage

GetUomTypeNum converts a canonical Velox UOM type code to its number and exposes the Quantity/Unit alias.

Parameters and result

ItemTypeDescription
aUomTypeCodestring, constCanonical UOM type code.
ResultVariantInteger 16 for a recognized code; otherwise Null.

Behaviour and edge cases

  • GetUomTypeNum('Quantity') returns Null; it does not return 1.
  • Letter case is ignored, so unit matches. Leading/trailing whitespace or punctuation changes return Null because the function does not trim.
  • Empty, unknown and numeric text return Null.
  • The result is a numeric Variant; test VarIsNull before assigning it to a non-nullable integer.
  • This maps UOM classification only and does not parse or convert measurement quantities or business unit codes.

Additional Technical Info

GetUomTypeNum converts a canonical Velox unit-of-measure type code to its numeric value. Matching is case-insensitive but otherwise exact. The word Quantity is not a recognized code: the internal Quantity and Unit string constants are both Unit.

Complete observable mapping

Input codeNumberNotes
Unit1Represents both internal Quantity and Unit constants.
Inner2Inner packaging.
Outer3Outer packaging.
Pallet4Pallet.
Hire5Hire item/container.
Tie6Tie.

Implementation quirk

The source comparison chain contains separate Type_Quantity_String and Type_Unit_String branches, but both constants contain Unit and both numeric constants equal 1. The first branch therefore always handles Unit; the second is unreachable for current constants. This does not change the returned value, but it confirms that Quantity is not an alternative accepted spelling.

Side effects, errors and performance

The function is pure and performs no I/O. It uses a fixed comparison chain; the duplicate first two branches are harmless but the second is unreachable in the current product.

Related entries

Created 2026-07-15