You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2011/11/26 00:08:46 UTC

DO NOT REPLY [Bug 118645] New: OOBasic function with array parameter and array return value only works once

https://issues.apache.org/ooo/show_bug.cgi?id=118645

             Bug #: 118645
        Issue Type: DEFECT
           Summary: OOBasic function with array parameter and array return
                    value only works once
    Classification: Application
           Product: Spreadsheet
           Version: OOo 3.3
          Platform: PC
        OS/Version: Windows 7
            Status: UNCONFIRMED
          Severity: major
          Priority: P5
         Component: programming
        AssignedTo: spreadsheet@openoffice.org
        ReportedBy: fs876@gmx.de
                CC: ooo-issues@incubator.apache.org


Hello, 

the attached file contains a functions "reverse_Array".
Steps to repro the issue:
- select D14:F14
- F2
- enter: =REVERSE_ARRAY(A14:C14)
- Ctrl+Shift+Enter

==> Okay so far, works as expected.

- Select D14:F16
- In Menu: Edit -> Fill -> Down

Shows:
a    b    c            
1    2    3    3    2    1
4    5    6    3    2    1
7    8    9    3    2    1

The array formla is correctly filled down, but not executed.

Code:
function reverse_Array(x as Array) as Array
    Dim i as Integer, k as Integer
    Dim Result()

    i = LBound(x,2)
    k = UBound(x,2)
    ReDim Result(i to k)

    k = UBound(x,2)
    for i = LBound(x,2) to UBound(x,2)
      Result(i) = x(1,k)
      k = k-1
    next
    reverse_Array = Result
end function

The other function in the file, which returns n^2, n^3, n^4 in an array, works.
Here we do not have an array as input parameter, only as return value.

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

DO NOT REPLY [Bug 118645] OOBasic function with array parameter and array return value only works once

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

--- Comment #1 from fs876@gmx.de 2011-11-25 23:10:46 UTC ---
Created attachment 77049
  --> https://issues.apache.org/ooo/attachment.cgi?id=77049
Macro code and small example

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

DO NOT REPLY [Bug 118645] OOBasic function with array parameter and array return value only works once

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

bmarcelly <bm...@openoffice.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bmarcelly@openoffice.org

--- Comment #2 from bmarcelly <bm...@openoffice.org> 2011-11-29 19:44:36 UTC ---
Before creating a bug report, you should have asked for advice in a forum like
http://user.services.openoffice.org/en/forum/ 

The function ret_array() works because it is designed to fill 3 cells on one
row. Then the returned value should be an array with indexes : 1 to 3, 1 to 1.
You are lucky that it works for an array with only one index.

The function reverse_Array() has an incorrect definition : array is not a
OOoBasic type. But this is not the problem.
You want that a single matrix function work on the whole rectangle of values to
produce a rectangle of results; then the function must return an array of data
with the same dimensions.
In the next attachment I have created function revlines() that works correctly.

I also have created function npower234() that works on the whole list of values
n to produce a rectangle of results n2, n3, n4.

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

DO NOT REPLY [Bug 118645] OOBasic function with array parameter and array return value only works once

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

--- Comment #4 from fs876@gmx.de 2011-12-02 21:55:56 UTC ---
Hello,

thank you for clarifying, that "array" is not a valid type. 
After changing "array" into "variant" everything works now in my real project.
I have rows (or columns) with a variable number of elements (input array) and
produce a fix number of output values (output array) and used Array(...) to
fill
internal arrays with numeric data. I didn't want the overhead, that is required
for "variant" data type. I think, for every access, OOcalc must check
internally, what kind of data is there and handle it appropriately. Since the
kind of data is known (e.g. Integer, String, Double, ...) then "variant" was
not really required.
So I used "array" instead of "variant". (I prefere strict type checking).
Maybe a syntax error should be shown, when a reserved word is used in wrong
context.
Thank you very much for your help.

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

DO NOT REPLY [Bug 118645] OOBasic function with array parameter and array return value only works once

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

--- Comment #3 from bmarcelly <bm...@openoffice.org> 2011-11-29 19:45:52 UTC ---
Created attachment 77057
  --> https://issues.apache.org/ooo/attachment.cgi?id=77057
Basic matrix functions

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

[Bug 118645] OOBasic function with array parameter and array return value only works once

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

Edwin Sharp <el...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |elish@apache.org
         Resolution|---                         |NOT_AN_ISSUE

--- Comment #5 from Edwin Sharp <el...@apache.org> ---
Not a bug per comment 4.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.