Merge pull request #14930 from Budibase/view-calc-count-non-numeric

Allow counting non-numeric fields in calculation views
This commit is contained in:
Andrew Kingston 2024-10-31 16:26:57 +00:00 committed by GitHub
commit d9b7e3e6e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 5 deletions

View File

@ -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
@ -234,7 +241,7 @@
<InfoDisplay
icon="Help"
quiet
body="Calculations only work with numeric columns and a maximum of 5 calculations can be added at once."
body="Most calculations only work with numeric columns and a maximum of 5 calculations can be added at once."
/>
<div>
@ -257,6 +264,4 @@
.group-by {
grid-column: 2 / 5;
}
span {
}
</style>