PADFoundationvariablesinitializationbootstrapfoundationsetupnaming-conventions

Variable Bootstrap

Initializes all standard run variables at the top of a PAD flow. Sets up typed placeholders for run tracking, status flags, counters, and common configuration values so every flow starts from a consistent, predictable state.

0 copies

Section 1: Initialize Run Tracking Variables

PAD Script
1**REGION Initialize Run Tracking Variables
2SET strRunId TO $'''(pending)'''
3SET strRunStatus TO $'''Running'''
4SET strErrorMessage TO $'''(none)'''
5SET numErrorCount TO 0
6SET numRecordsProcessed TO 0
7SET boolSuccess TO False
8**ENDREGION

Section 2: Create Log List and Generate Run ID

PAD Script
1**REGION Create Log List and Generate Run ID
2Variables.CreateNewList List=> lstLogEntries
3DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> dtRunStart
4Text.ConvertDateTimeToText.FromCustomDateTime DateTime: dtRunStart CustomFormat: $'''yyyyMMdd-HHmmss''' Result=> strRunId
5SET strRunId TO $'''RUN-%strRunId%'''
6**ENDREGION

Usage Notes

  • Place this pattern at the very top of your Main flow before any business logic executes
  • strRunId is generated as RUN-yyyyMMdd-HHmmss to uniquely identify each execution — use it in all log entries and error messages
  • lstLogEntries is an in-memory list used by the Log Detail Writer pattern to accumulate log lines during the run
  • strRunStatus starts as Running and should be updated to Success or Failed by the Run Finalizer at the end of the flow
  • numErrorCount and numRecordsProcessed are shared counters — increment them in your processing loops and error handlers
  • boolSuccess provides a simple boolean flag for downstream conditional logic (e.g., whether to send a success or failure email)
  • All variable names use Hungarian notation prefixes (str, num, bool, dt, lst) for readability and consistency across FlowLibs patterns

Requirements

  • No external dependencies — uses only built-in PAD actions
  • DateTime action must be available (included in all PAD versions)
  • Downstream patterns (Run Header Initializer, Log Detail Writer, Run Finalizer) expect these exact variable names
  • Flow must have write access to create list variables in memory