Know and understand validation routines including range check, character check, length check, type check, format check, presence check, check digit

Published by Patrick Mutisya · 14 days ago

ICT 0417 – The Systems Life Cycle: Validation Routines

The Systems Life Cycle

Objective

Know and understand validation routines including range check, character check, length check, type check, format check, presence check, and check digit.

What is Data \cdot alidation?

Data validation is the process of ensuring that the data entered into a system meets the required criteria before it is processed or stored. Validation is a key activity in the Implementation and Testing phases of the systems life cycle.

Common \cdot alidation Routines

1. Range Check

Ensures that a numeric value falls within a predefined minimum and maximum.

Example: Age must be between 0 and 120.

2. Character Check

Verifies that a character belongs to an allowed set (e.g., letters only, digits only).

Example: A country code must consist of uppercase letters A–Z.

3. Length Check

Confirms that the number of characters entered matches the required length.

Example: A UK post‑code must be 5–7 characters long.

4. Type Check

Ensures that the data type entered matches the expected type (numeric, alphabetic, alphanumeric, date, etc.).

Example: A field for “Quantity” must be numeric.

5. Format Check

Validates that the data follows a specific pattern, often using regular expressions.

Example: A telephone number must match the pattern +44 0 1234 567890.

6. Presence Check (Mandatory Field)

Ensures that a required field is not left blank.

Example: The “Email Address” field must contain a value before the form can be submitted.

7. Check Digit

A mathematical digit added to a number to help detect errors in data entry or transmission. The check digit is calculated using a specific algorithm (e.g., Mod‑10, Mod‑11).

Example: ISBN‑13 uses a check digit calculated as:

\$\$

\text{Check Digit} = (10 - ( \sum{i=1}^{12} wi \times d_i \bmod 10 )) \bmod 10

\$\$

where \$wi\$ is 1 for odd positions and 3 for even positions, and \$di\$ are the first 12 digits of the ISBN.

Validation Routine Summary

Check TypePurposeTypical ExampleCommon Implementation
Range CheckValue within minimum and maximum limitsAge 0–120if (value >= min && value <= max) …
Character CheckAllowed characters onlyCountry code A–Zregex /^[A-Z]+$/
Length CheckExact or range of charactersPost‑code 5–7 charactersif (len >= 5 && len <= 7) …
Type CheckCorrect data type (numeric, date, etc.)Quantity numericisNaN(value) === false
Format CheckSpecific pattern requiredPhone +44 0 1234 567890regex /^\+44\s0\s\d{4}\s\d{6}$/
Presence CheckField must not be emptyEmail address requiredif (value.trim() !== '') …
Check DigitDetect entry errors using algorithmISBN‑13 validationCalculate using Mod‑10 algorithm

Where \cdot alidation Fits in the Systems Life Cycle

  1. Analysis – Identify data requirements and validation rules.
  2. Design – Specify validation routines in system specifications.
  3. Implementation – Code the validation checks into forms, screens, and APIs.
  4. Testing – Verify that each validation routine works correctly (unit testing, integration testing).
  5. Deployment – Ensure that validation logic is active in the live environment.
  6. Maintenance – Update validation rules when business rules change.

Suggested diagram: Flow of validation checks within the Implementation phase of the systems life cycle.