From c85dd1f6f89070c338f3e8487ee61bbd5f42ba0d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 31 Oct 2024 14:30:54 +0000 Subject: [PATCH 1/2] Allow counting on non-numeric fields --- .../buttons/grid/GridViewCalculationButton.svelte | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte index f6ef6e6099..851dfb6777 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte @@ -90,8 +90,15 @@ const getFieldOptions = (self, calculations, schema) => { return Object.entries(schema) .filter(([field, fieldSchema]) => { - // Only allow numeric fields that are not calculations themselves - if (fieldSchema.calculationType || !isNumeric(fieldSchema.type)) { + // Don't allow other calculation columns + if (fieldSchema.calculationType) { + return false + } + // Only allow numeric columns for most calculation types + if ( + self.type !== CalculationType.COUNT && + !isNumeric(fieldSchema.type) + ) { return false } // Don't allow duplicates @@ -257,6 +264,4 @@ .group-by { grid-column: 2 / 5; } - span { - } From 986cef6b25ebdcbb7260bd69004983908a8ad24d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 31 Oct 2024 14:35:00 +0000 Subject: [PATCH 2/2] Update view calculation explanation text --- .../DataTable/buttons/grid/GridViewCalculationButton.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte index 851dfb6777..7b279d3948 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/grid/GridViewCalculationButton.svelte @@ -241,7 +241,7 @@