This code sets variables to define a time period (previous calendar month) dynamically changing the SQL statement sent to source
let vLastMonth = Year(AddMonths(now(),-1)) & '-' & num(month(addmonths(now(),-1)),'00') & '-01';
// This gets the first of the previous month
let vThisMonth = Year(now()) & '-' & num(month(now()),'00') & '-01';
// This gets the first of the current month
ODBC CONNECT TO MyDSN;
LOAD *;
SQL SELECT
DATE,
NAME,
CODE
FROM MyTable
WHERE DATE >= '$(vLastMonth)' AND
DATE < '$(vThisMonth)';
// This gets the first of the previous month
let vThisMonth = Year(now()) & '-' & num(month(now()),'00') & '-01';
// This gets the first of the current month
ODBC CONNECT TO MyDSN;
LOAD *;
SQL SELECT
DATE,
NAME,
CODE
FROM MyTable
WHERE DATE >= '$(vLastMonth)' AND
DATE < '$(vThisMonth)';