Bug 105558 - Various BASIC return types result in text string instead of number
Summary: Various BASIC return types result in text string instead of number
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL: https://ask.libreoffice.org/en/questi...
Whiteboard: target:5.4.0 target:5.3.1 target:7.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-26 20:18 UTC by Eike Rathke
Modified: 2021-04-09 12:42 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eike Rathke 2017-01-26 20:18:34 UTC
The BASIC function

Function TestFunc() As Currency
    Dim Result As Currency
    Result = 5.50
    TestFunc = Result
End Function

used in a spreadsheet as =TESTFUNC() returns a text string result instead of number, hence number formatting (e.g. currency format) and further calculations with the value don't yield the expected results.
Comment 1 Eike Rathke 2017-01-26 20:24:03 UTC
Actually of the list of available SbxDataType only SbxINTEGER, SbxLONG, SbxSINGLE and SbxDOUBLE are accepted as number, all other result in text string.
Comment 2 krafczyk.matthew 2017-01-26 22:15:30 UTC
I'm interested in fixing this. (I'm the guy who asked the question)

What methods are related to this problem?
Comment 3 Eike Rathke 2017-01-27 13:19:41 UTC
I already fixed it, will commit soon.
For interest, it's in sc/source/core/tool/interpr4.cxx ScInterpreter::ScMacro()
Comment 4 Commit Notification 2017-01-27 13:59:31 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9a283e44ca7de2f2fa276544b4d49cff495bd53d

Resolves: tdf#105558 accept numeric BASIC return types as numeric

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Eike Rathke 2017-01-27 14:12:29 UTC
Pending review https://gerrit.libreoffice.org/33616 for 3-5
Comment 6 Commit Notification 2017-01-27 16:39:16 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ea525e91338a164bbc76954869295f1e939095ae&h=libreoffice-5-3

Resolves: tdf#105558 accept numeric BASIC return types as numeric

It will be available in 5.3.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 krafczyk.matthew 2017-01-27 18:27:10 UTC
I can confirm that this issue is fixed in the master branch of the git repo.
Comment 8 Commit Notification 2021-04-09 12:42:02 UTC
rounak committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7a3a21657bbbf7c4187fc4ff6a45dda5512951a2

tdf#105558: sc_macros: Add unittest

It will be available in 7.2.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.