tdf117433 COUNIF doesn't count cells after first column in range for empty criteria

Eike Rathke erack at redhat.com
Tue May 8 12:52:13 UTC 2018


Hi Winfried,

On Tuesday, 2018-05-08 07:46:46 +0000, Winfried Donkers wrote:

> I found what causes the problem of bug tdf117443, but I don't understand why the code is as it is now and therefore I am reluctant to change it.
> In sc/source/core/data/dociter.cxx:ScQueryValueIterator::GetThis()

ScQueryCellIterator::GetThis() that is..

> there is a loop in lines 1132-1143 that is entered as soon as the first column of the range has been processed and a new column is started.
> The loop skips empty columns, which is annoying when you want to count empty cells.
> 
> Do you know/remember if this code is only there to improve efficiency of the iterator?

Yes, because for all other queries than empty cells an empty column
doesn't need to be handled.

> Would it be a good idea to add a boolean mbDontSkipEmptyCols to
> ScQueryValueIterator which is only set to true for e.g. ScCountIf
> (ideally only when empty cell is part of the query, but I don't know
> if that can be achieved simply).?

It shouldn't need another parameter, just evaluating also
rItem.mbMatchEmpty there should be sufficient, so

            while (!rItem.mbMatchEmpty && pCol->IsEmptyData());

(untested)

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20180508/1efc9deb/attachment.sig>


More information about the LibreOffice mailing list