Bug 100818 - add ability to refer to local names in another worksheet to INDIRECT
Summary: add ability to refer to local names in another worksheet to INDIRECT
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyInteresting, easyHack, skillCpp
: 123790 (view as bug list)
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2016-07-09 00:25 UTC by sebalis
Modified: 2019-03-01 22:03 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
test case as described in the bug description (8.16 KB, application/x-vnd.oasis.opendocument.spreadsheet)
2016-07-09 00:25 UTC, sebalis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sebalis 2016-07-09 00:25:11 UTC
Created attachment 126131 [details]
test case as described in the bug description

Bug #96915 added the capability to refer to names that are defined in another worksheet and have local scope there with the normal syntax for names, i.e. Sheet!Name. Before that, this notation only worked for names either having local scope in the same worksheet or global names. But what is still missing is for INDIRECT to deal with this situation too. The attached spreadsheet "local-name-test.ods" has a local name "pi_value" in Sheet2, and Sheet1 contains one cell refering to with in the formula =Sheet2!pi_value and another cell with the formula =INDIRECT("Sheet2!pi_value"). In LibreOffice 5.2.0.1 the first cell works, the second gives a #REF! error. I don’t know Calc well enough to be certain that there is no other function that would have to be adapted to deal with references of this kind, so I’d be grateful if whoever gets to work on this bug could give this some thought. Thank you for fixing Bug #96915 and for considering this one.
Comment 1 m.a.riosv 2016-07-09 14:07:59 UTC
Reproducible
Win10x64
Version: 5.3.0.0.alpha0+
Build ID: 757f221bceb74ccc2af8a9d4de149076280f29fb
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-06-23_23:54:55
Comment 2 QA Administrators 2018-07-24 02:37:07 UTC Comment hidden (obsolete)
Comment 3 sebalis 2018-07-24 14:52:27 UTC
The bug is still present in 6.06rc1.

Version: 6.0.6.1
Build ID: 1:6.0.6~rc1-1~bpo9+1
CPU threads: 4; OS: Linux 4.9; UI render: default; VCL: gtk3; 
Locale: en-GB (en_DE.utf8); Calc: group

I don’t see much point in testing for a regression, because before Eike Rathke fixed bug #96915 (also reported by me) regarding the same issue outside INDIRECT, it would have been unthinkable that this would have worked. And ever since that other was fixed, I have been intermittently checking whether it would work – it never did.
Comment 4 sebalis 2019-02-20 04:48:56 UTC
The bug is still present in Libreoffice 6.2.0.3 (Arch Linux version number). I am finding it hard to understand that a formula that works outside of INDIRECT works but when given to INDIRECT as a string it does not.
Comment 5 Eike Rathke 2019-02-20 12:43:36 UTC
(In reply to sebalis from comment #4)
> I am finding it hard to understand that a formula that works outside of
> INDIRECT works but when given to INDIRECT as a string it does not.
You sure dug into the code and at least tried to understand what's happening there?
Comment 6 Eike Rathke 2019-02-20 12:44:15 UTC
Could be suitable for an interesting EasyHack, marking as such.
Code pointer:
sc/source/core/tool/interpr1.cxx ScInterpreter::ScIndirect() and follow / step through in debugger what's happening there for a sheet local scope name.
Comment 7 sebalis 2019-02-20 13:56:05 UTC
> You sure dug into the code and at least tried to understand
> what's happening there?

No, sorry. I commented from the point of viewer of a user who has worked as a software developer, but not with C++. I did not expect to be able to gain insights in an appropriate amount of time so I’ve never looked at the LibreOffice code. What I did think is that the task is the same – parsing a string into a structure representing the formula, and then executing it – so I really thought that your work on bug bug #96915 (thanks again) would have covered the INDIRECT case immediately.
Comment 8 m.a.riosv 2019-03-01 22:03:31 UTC
*** Bug 123790 has been marked as a duplicate of this bug. ***