The actual version was not listed in the box. The bug is concerning the API. "Component" might better be "sdk". (Donno) Example is in BASIC Version: 6.3.3.1 (x64) Build ID: f41f4c7f9507aeca13cb9df51f34d80e8ba30a99 CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; Locale: en-GB (de_DE); UI-Language: en-GB Calc: CL Create a new document and a new module in its BASIC standard library. Paste Sub demo() fa = createUnoService("com.sun.star.sheet.FunctionAccess") r = fa.callFunction("RAND",Array()) Print TypeName(r) REM r is "Object(0 To 0)" now with r(0)(0) containing the result. Dim q As Double q = fa.callFunction("RAND",Array()) REM Above statement throws an error "Object variable not set". End Sub into that module. Execute the Sub stepwise and verify the behaviour described by the REM lines.
As just tested the bug was already present in V 6.1.2.1. Version field changed. The youngest version I could test with and which did not show the bug was 6.0.4.2.
confirming > The youngest version I could test with and which did not > show the bug was 6.0.4.2. btw: works with LO 6.0.7.3 too but still reproducible with: Version: 6.4.0.0.alpha1+ (x64) Build ID: 40b469fdb6dec080a90542935f94d497aa067ef4 CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; Locale: de-DE (de_DE); UI-Language: en-US Calc: threaded
that looks like an intended change, started with: https://gerrit.libreoffice.org/plugins/gitiles/core/+/2dc7a3b7515ffd6181d740aca4ad6e0549ea4a3a commit 2dc7a3b7515ffd6181d740aca4ad6e0549ea4a3a [log] author Eike Rathke <erack@redhat.com> Tue Jul 10 15:58:17 2018 +0200 committerMarkus Mohrhard <markus.mohrhard@googlemail.com> Fri Jul 13 22:00:45 2018 +0200 tree f23c859f0338062a38e773db4f3e126bbdfbd9e1 parent 4e4421325d406cc555f15c2b8b5bbab443eb6a7d [diff] Resolves: tdf#118624 let RAND() in array/matrix mode fill a matrix ... instead of only top left that is referenced for other elements. Change-Id: I718946d7e4327b152e2d9f80712395fd7ab67dee Reviewed-on: https://gerrit.libreoffice.org/57235 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> (cherry picked from commit 8afccbd129ecda81ff00dd2c6e5e10af254ae0ef) Reviewed-on: https://gerrit.libreoffice.org/57247 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
A tad unfortunate.. callFunction() per default is executed in array mode, you can change that by setting the com.sun.star.sheet.FunctionAccess property IsArrayFunction to false. See https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1sheet_1_1FunctionAccess.html#a7f24813b5c506f8f0d3eb81f864c741e Nevertheless, we maybe could let RAND() return a scalar double even in array mode if a 1x1 matrix is hit, for better backwards compatibility.
(In reply to Eike Rathke from comment #4) > ... > you can change that by setting the com.sun.star.sheet.FunctionAccess > property IsArrayFunction to false. ... Cannot access this property. It is not shown in the IDE and not listed in the PropertySetInfo of a FunctionAccess object.
It's an optional property at the service, just try to set it.
I tried fa = createUnoService("com.sun.star.sheet.FunctionAccess") fa.IsArrayFunction = False but got "Property or method not found: IsArrayFunction." This was the behaviour with versions 3.3 , 5.4.4, and 6.3.3.1.
fa.setPropertyValue("IsArrayFunction", False)
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/445727d3bce84ef04719242745aac9446035c5bd Resolves: tdf#128218 Let RAND() return a scalar double instead of a 1x1 matrix It will be available in 6.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Pending review https://gerrit.libreoffice.org/81492 for 6-3
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-6-3": https://git.libreoffice.org/core/commit/75c1c58c4ae47dd0bad98dbe95e99d5d3de377de Resolves: tdf#128218 Let RAND() return a scalar double instead of a 1x1 matrix It will be available in 6.3.4. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/178e3acd41225d2ba0c1bcca371c34770f1f30db tdf#128218: sc_macros_test: Add unittest It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.