include forecast name

This commit is contained in:
Paul Trowbridge 2022-04-09 02:26:38 -04:00
parent 8f2a7431bc
commit b17c37788e
3 changed files with 8 additions and 5 deletions

View File

@ -63,6 +63,7 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
var app_plug_fromdate = req.body.app_plug_fromdate;
var app_plug_todate = req.body.app_plug_todate;
var app_openstatus_code = req.body.app_openstatus_code;
var app_forecast_name = req.body.app_forecast_name;
var callback = function(arg) {
sql = arg;
@ -77,6 +78,7 @@ server.get('/baseline', bodyParser.json(), function(req, res) {
sql = sql.replace(new RegExp("app_openstatus_code", 'g'), app_openstatus_code);
sql = sql.replace(new RegExp("app_plug_fromdate", 'g'), app_plug_fromdate);
sql = sql.replace(new RegExp("app_plug_todate", 'g'), app_plug_todate);
sql = sql.replace(new RegExp("app_forecast_name", 'g'), app_forecast_name);
//execute the sql and send the result
args.push(req.body.app_baseline_from_date);
console.log(sql);

View File

@ -105,7 +105,7 @@ $$SELECT
$$::text||
_clist||
$$
,'forecast_name' "version"
,'app_forecast_name' "version"
,'actuals' iter
,null::bigint app_logid
FROM
@ -133,7 +133,7 @@ SELECT
$$SELECT
$$||_clist_inc||
$$
,'forecast_name' "version"
,'app_forecast_name' "version"
,'plug' iter
,null::bigint app_logid
FROM
@ -155,7 +155,7 @@ $$,incr AS (
SELECT
$$||_clist_inc||
$$
,'forecast_name' "version"
,'app_forecast_name' "version"
,'baseline' iter
,null::bigint app_logid
FROM
@ -183,7 +183,7 @@ INTO
------------------------------stack the sql into the final format------------------------------------------------
SELECT
$$DELETE FROM $$||_target_table||$$ WHERE $$||_version_col||$$ = 'forecast_name';
$$DELETE FROM $$||_target_table||$$ WHERE $$||_version_col||$$ = 'app_forecast_name';
WITH
baseline AS (
$$||_ytdbody||

View File

@ -5,5 +5,6 @@
"app_openorder_cutoff":"2020-09-30",
"app_openstatus_code":"'OPEN','BACKORDERD'",
"app_plug_fromdate":"2019-10-01",
"app_plug_todate":"2020-05-31"
"app_plug_todate":"2020-05-31",
"app_forecast_name":"dev"
}