From 36260e44194773ef0b871a55a27b626b7d41c00c Mon Sep 17 00:00:00 2001 From: likp Date: Mon, 14 Apr 2025 09:57:05 +0200 Subject: [PATCH 1/2] Set the right include type --- PxWeb/Code/Api2/DataSelection/Bjarte3.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/PxWeb/Code/Api2/DataSelection/Bjarte3.cs b/PxWeb/Code/Api2/DataSelection/Bjarte3.cs index 96e15988..c14a1c91 100644 --- a/PxWeb/Code/Api2/DataSelection/Bjarte3.cs +++ b/PxWeb/Code/Api2/DataSelection/Bjarte3.cs @@ -270,7 +270,14 @@ private static void ReapplyCodelist(IPXModelBuilder builder, PXMeta meta) } else if (variable.CurrentGrouping != null) { - builder.ApplyGrouping(variable.Code, variable.GetGroupingInfoById(variable.CurrentGrouping.ID), GroupingIncludesType.AggregatedValues); + var grouping = variable.GetGroupingInfoById(variable.CurrentGrouping.ID); + + if (grouping is null) + { + throw new Exception($"Could not find grouping {variable.CurrentGrouping.ID} for variable {variable.Code}"); + } + + builder.ApplyGrouping(variable.Code, variable.GetGroupingInfoById(variable.CurrentGrouping.ID), grouping.GroupPres); } else if (variable.CurrentValueSet != null) { From c113a1f8a16658bd89341d16f4666b8a90a3fc2f Mon Sep 17 00:00:00 2001 From: likp Date: Mon, 14 Apr 2025 10:10:37 +0200 Subject: [PATCH 2/2] Cahnged to argument exception --- PxWeb/Code/Api2/DataSelection/Bjarte3.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PxWeb/Code/Api2/DataSelection/Bjarte3.cs b/PxWeb/Code/Api2/DataSelection/Bjarte3.cs index c14a1c91..465fcc81 100644 --- a/PxWeb/Code/Api2/DataSelection/Bjarte3.cs +++ b/PxWeb/Code/Api2/DataSelection/Bjarte3.cs @@ -274,7 +274,7 @@ private static void ReapplyCodelist(IPXModelBuilder builder, PXMeta meta) if (grouping is null) { - throw new Exception($"Could not find grouping {variable.CurrentGrouping.ID} for variable {variable.Code}"); + throw new ArgumentException($"Could not find grouping {variable.CurrentGrouping.ID} for variable {variable.Code}"); } builder.ApplyGrouping(variable.Code, variable.GetGroupingInfoById(variable.CurrentGrouping.ID), grouping.GroupPres);