From ab01f61365fdf44bc21c970471a2b70266ab2c63 Mon Sep 17 00:00:00 2001 From: JohnathonStoneMS Date: Thu, 3 Dec 2020 10:31:24 -0800 Subject: [PATCH] Catch error where source table has no rows --- RequireRecentData.qvs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/RequireRecentData.qvs b/RequireRecentData.qvs index 66b5e5c..ffff163 100644 --- a/RequireRecentData.qvs +++ b/RequireRecentData.qvs @@ -36,6 +36,15 @@ Sub RequireRecentData(vTableNameToInspect, vDataRecencyFieldName, vDataRecencyTh Resident [$(vTableNameToInspect)] ; + // Check to ensure that a min timestamp was found + Let vTableRowCount = NoOfRows('Min Data Access Time'); + + If $(vTableRowCount) < 1 Then + Let vMessage = '[ERROR] Could not find a data access timestamp in the source table, $(vTableNameToInspect), because it has $(vTableRowCount) rows'; + Trace $(vMessage); + Call ThrowException('$(vMessage)'); + End If + Let vMinDataAccessTimestamp = Timestamp(Peek('Min Data Access Time', 0, 'Min Data Access Time')); Drop Table [Min Data Access Time]; Trace Data access time: $(vMinDataAccessTimestamp) UTC;