This commit is contained in:
Daniel 2023-10-09 21:09:35 +08:00
parent 288eb24474
commit 0ed6884761
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -804,8 +804,10 @@ func (table *Table) calcColSelect(col *TableColumn, colIndex int) {
uniqueValues := map[string]bool{}
for _, row := range table.Rows {
if nil != row.Cells[colIndex] && nil != row.Cells[colIndex].Value && nil != row.Cells[colIndex].Value.MSelect && 0 < len(row.Cells[colIndex].Value.MSelect) && nil != row.Cells[colIndex].Value.MSelect[0] && "" != row.Cells[colIndex].Value.MSelect[0].Content {
uniqueValues[row.Cells[colIndex].Value.MSelect[0].Content] = true
countUniqueValues++
if _, ok := uniqueValues[row.Cells[colIndex].Value.MSelect[0].Content]; !ok {
uniqueValues[row.Cells[colIndex].Value.MSelect[0].Content] = true
countUniqueValues++
}
}
}
col.Calc.Result = &Value{Number: NewFormattedValueNumber(float64(countUniqueValues), NumberFormatNone)}