From d37aded2c91af91950b43db02e033ddf75f46e6d Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 11 Aug 2025 11:00:40 -0400 Subject: [PATCH] history should be in an array --- example_usage.ms.sql | 2 ++ example_usage.pg.sql | 3 ++- procs/single_price_call.ms.sql | 2 +- quote_review/quote_review.pg.sql | 3 +-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example_usage.ms.sql b/example_usage.ms.sql index 9136451..8c04bac 100644 --- a/example_usage.ms.sql +++ b/example_usage.ms.sql @@ -6,6 +6,8 @@ EXEC pricing.single_price_call @v1ds = 'v1:T..BDL..', @vol = 50000; +SELECT * FROM pricing.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100' + EXEC pricing.single_price_call @bill = 'GRIF0001', @ship = 'GRIF0001', diff --git a/example_usage.pg.sql b/example_usage.pg.sql index 83c1ad0..c075e4d 100644 --- a/example_usage.pg.sql +++ b/example_usage.pg.sql @@ -1,5 +1,5 @@ SELECT - * + ui_json->'details' FROM pricequote.single_price_call( 'FARM0001', 'KEYB0001', @@ -8,3 +8,4 @@ FROM pricequote.single_price_call( 50000 ) f +SELECT * FROM pricequote.lastpricedetail l WHERE customer = 'HYBELS' AND l.partgroup = 'HZP3E100' \ No newline at end of file diff --git a/procs/single_price_call.ms.sql b/procs/single_price_call.ms.sql index b5d826b..841ca5c 100644 --- a/procs/single_price_call.ms.sql +++ b/procs/single_price_call.ms.sql @@ -455,7 +455,7 @@ BEGIN ' | Dataseg: ', ISNULL(q.last_dataseg, 'N/A'), ' | Qty: ', ISNULL(CAST(q.last_qty AS varchar(32)), 'N/A') ) AS note - FOR JSON PATH, WITHOUT_ARRAY_WRAPPER + FOR JSON PATH ) AS details UNION ALL diff --git a/quote_review/quote_review.pg.sql b/quote_review/quote_review.pg.sql index ebf3d91..d72178d 100644 --- a/quote_review/quote_review.pg.sql +++ b/quote_review/quote_review.pg.sql @@ -105,7 +105,7 @@ lq AS MATERIALIZED ( -- ,jsonb_pretty(pricing) pricing ,p.guidance_price ,p.guidance_reason - ,jsonb_pretty(p.expl) expl + ,jsonb_pretty(p.ui_json->'details') expl FROM lq LEFT OUTER JOIN "CMS.CUSLG".itemm i ON @@ -131,7 +131,6 @@ lq AS MATERIALIZED ( lq.billto ,lq.shipto ,lq.part - ,substring(lq.part,1,8) ,lq.v1ds ,lq.units_each ) p ON TRUE