https://bugs.documentfoundation.org/show_bug.cgi?id=156467

            Bug ID: 156467
           Summary: Should COLUMN() and ROW() in array mode in the case of
                    a single element matrix be changed to return a scalar
                    value?
           Product: LibreOffice
           Version: 7.5.3.2 release
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: joshua_coppersm...@hotmail.com

Description:
When using a construction such as {=MyUDF(INDIRECT(ADDRESS(2,COLUMN())))} the
function MyUDF will receive a matrix as its parameter. Perhaps ADDRESS is
passing along an array of identical addresses based on COLUMN() returning an
array in the array context, causing INDIRECT to continue with the array. When
this construction is used in a single cell array formula this behavior is
peculiar at best, as the user would expect the text return from ADDRESS to
"wash" the array nature of the COLUMN() function. Instead, it 'mysteriously
breaks' for the user since ADDRESS is prodded by COLUMN() to return an array of
identical addresses and BASIC will throw a generic "Object variable not set"
when MyUDF is not prepared for an array. Any MyUDF with signature like
MyUDF(Value As String) As String will fail.

Steps to Reproduce:
1. Create a UDF like MyUDF(Value As String) As String
2. Use a construct like {=MyUDF(INDIRECT(ADDRESS(2,COLUMN())))} as an array
formula in a single cell

Actual Results:
BASIC throws an "Object variable not set" error.

Expected Results:
MyUDF would perform as normal, receiving a String (or whatever) and not an
array.


Reproducible: Always


User Profile Reset: No

Additional Info:
Thanks to erAck/AskLO for much clarification and even wording to describe the
concern. Any errors in interpretation are entirely mine.

Excel 2021 performs according to "Expected Results" in an identical setup. When
'unboxing' the Value parameter Range object Excel will not report it to be an
array. I.e.

Function MyUDF(Value As Variant) As String
    Rem Notice Variant parameter to be able to test for array
    MsgBox IsArray(Value)
    MyUDF = Value
End Function

will display 'False'

and

Function MyUDF(Value As String) As String
    Rem Notice String parameter which causes error in LO Calc
    MyUDF = Value
End Function

will function as "Expected Results".

Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 20; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to