Bug 72474 - It works correctly GeneralFunction.COUNT ?
Summary: It works correctly GeneralFunction.COUNT ?
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.2.0.0.beta2
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-12-08 12:16 UTC by Petr Neudek
Modified: 2014-03-20 14:45 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
ComputeFunctionCount.ods (12.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2013-12-08 14:44 UTC, pierre-yves samyn
Details
PNG picture (42.07 KB, image/png)
2013-12-08 16:09 UTC, Petr Neudek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Neudek 2013-12-08 12:16:16 UTC
This feature is working properly?

CellRange.computeFunction (com.sun.star.sheet.GeneralFunction.COUNT)

So Basic function that originally envisaged not only numbers, but also the string.
- You really only counts numerical values. Back many years - but do not know what version of LO (about 4) calculated as a function of the workbook COUNTA. You really counts as ordinary COUNT from the workbook. It just does not take string.

For example, in AOO 4.0.1 sentiments were also strings.

- I'm not quite sure if this is a bug or intention. I know for sure that this is the cause of many failures of different extensions, functions and macros. I got it almost everywhere. Of course I can work around it, but this is not the solution for all older works worldwide.
Comment 1 pierre-yves samyn 2013-12-08 14:43:52 UTC
Hello

I confirm the bug on windows 7/64 & Version: 4.2.0.0.beta2
Build ID: 1a27be92e320f97c20d581a69ef1c8b99ea9885d

According to http://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet.html#ad184d5bd9055f3b4fd57ce72c781758d

com.sun.star.sheet.GeneralFunction.COUNT: all values, including non-numerical values, are counted. 

with COUNTNUMS: numerical values are counted. 

Actual result: only numerical values are counted with COUNT

Steps to reproduce: 

1. Open the attached ComputeFunctionCount.ods
(some text and numbers in A1:A5 and COUNT-COUNTA formula in A7:A8)
2.Click on the buttons to launch the macros

Expected result: same display as COUNT-COUNTA formula 
Actual result: same result with GeneralFunction.COUNTNUMS & 
GeneralFunction.COUNT

Was ok with Version: 4.1.3.2
Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a

The macros:

Sub MyCount
Dim f As Object, c As Object

f = ThisComponent.sheets.getByIndex(0)
c = f.getCellRangeByName("A1:A5")

print c.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT)

End Sub

Sub MyCountNums
Dim f As Object, c As Object

f = ThisComponent.sheets.getByIndex(0)
c = f.getCellRangeByName("A1:A5")

print c.computeFunction(com.sun.star.sheet.GeneralFunction.COUNTNUMS)

End Sub

Regards
Pierre-Yves
Comment 2 pierre-yves samyn 2013-12-08 14:44:35 UTC
Created attachment 90458 [details]
ComputeFunctionCount.ods
Comment 3 Petr Neudek 2013-12-08 16:09:09 UTC
Created attachment 90468 [details]
PNG picture
Comment 4 Petr Neudek 2013-12-08 16:10:06 UTC
Greetings.
I'm sorry but for me it goes really wrong - send image-
Peter
Comment 5 pierre-yves samyn 2013-12-08 16:35:12 UTC
Hello Peter

(In reply to comment #4)
> I'm sorry but for me it goes really wrong - send image-

My english is bad, I may have misspoken but I said: 

"I confirm the bug on windows 7/64
...
Actual result: only numerical values are counted with COUNT"

So, it goes wrong for me too, this is why I confirmed.

Regards
Pierre-Yves
Comment 6 Petr Neudek 2013-12-08 17:36:17 UTC
It's my fault.
I do not speak English at all. I can only read a little bit. Should I just use Google translator.
Thanks again and excuse
Peter
______________________________________________________________
> Od: <bugzilla-daemon@freedesktop.org>
> Komu: <neutr@atlas.cz>
> Datum: 08.12.2013 17:35
> Předmět: [Bug 72474] It works correctly GeneralFunction.COUNT ?
>
 
Comment # 5 on bug 72474 from  pierre-yves samynHello Peter(In reply to comment #4)> I'm sorry but for me it goes really wrong - send image-My english is bad, I may have misspoken but I said: "I confirm the bug on windows 7/64...Actual result: only numerical values are counted with COUNT"So, it goes wrong for me too, this is why I confirmed.RegardsPierre-YvesYou are receiving this mail because:

 * You reported the bug.
Comment 7 Andras Timar 2014-03-20 14:45:25 UTC
The bug is present in 4.2.0.0beta2, but I found it fixed in 4.2.0.2 and newer versions.