You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/03/04 10:41:36 UTC

DO NOT REPLY [Bug 52818] New: Implementation of the RANK function

https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

             Bug #: 52818
           Summary: Implementation of the RANK function
           Product: POI
           Version: 3.8-dev
          Platform: PC
        OS/Version: Windows Vista
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: roadlit@gmail.com
    Classification: Unclassified


Created attachment 28414
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28414
implemenation of RANK

I could not find the implementation of RANK in POI3.8, so I proceed to create
one. See attachment. 

I also "add retval[216] = new Rank();" to private static Function[]
produceFunctions().


Thanks

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

rubin wang <ro...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28419|FunctionEval.txt            |FunctionEval.java
           filename|                            |
  Attachment #28419|FunctionEval.txt            |FunctionEval.java
        description|                            |

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Yegor Kozlov <ye...@dinom.ru> 2012-03-05 12:14:05 UTC ---
Patch applied in r1297021

Thanks,
Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

--- Comment #3 from rubin wang <ro...@gmail.com> 2012-03-05 08:37:34 UTC ---
Created attachment 28418
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28418
Rank.java

Implementation of RANK(ARG1, ARG2, ARG3). Based on the description in
http://office.microsoft.com/en-us/excel-help/rank-function-HP010062535.aspx?CTT=5&origin=HA010277524.

The algorithm is as follows:

1) throw EvaluationException(ErrorEval.NUM_ERROR) if either ARG0 does not
contain a number or ARG3 does not contain 0 or 1.

2) set rank=0, search each cell in the range specified by ARG2, if the cell
contains a number greater than ARG0 and ARG3 is 0, or lower than ARG0 and ARG3
is 1, then rank++;  If the cell does not contain a number, then ignore this
cell.

3) return the value of rank

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2012-03-05 07:14:17 UTC ---
Any chance you could upload a unit test for your implementation?

How to test:

 - open ./test-data/spreadsheet/FormulaEvalTestData.xls and fill the
placeholder for RANK. Just follow the pattern that other functions use. The
formula testing framework will find and run this test automatically.
- It is a good idea to test against the example from MS Office online help:
http://office.microsoft.com/en-us/excel-help/rank-function-HP010062535.aspx?CTT=5&origin=HA010277524.
Also check that your implementation follows the spec and correctly handles
ordered/unordered lists, duplicates, not numbers, etc.


Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

--- Comment #4 from rubin wang <ro...@gmail.com> 2012-03-05 08:45:08 UTC ---
Created attachment 28419
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28419
FunctionEval.txt

Add one line "retval[216] = new Rank();" to the function "private static
Function[] produceFunctions()" This is the only change.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52818] Implementation of the RANK function

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52818

rubin wang <ro...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28414|0                           |1
        is obsolete|                            |

--- Comment #2 from rubin wang <ro...@gmail.com> 2012-03-05 08:26:59 UTC ---
Created attachment 28417
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28417
FormulaEvalTestData.xls (tests for RANK added)

Test case

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org