Bug 100602 - EDITING: Expressions with global scope shouldn't be copied to a local scope, when a sheet is copied. Released notes 5.2
Summary: EDITING: Expressions with global scope shouldn't be copied to a local scope, ...
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.2.0.0.beta2
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-25 12:25 UTC by m_a_riosv
Modified: 2016-07-23 04:48 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Tes file to copy global local named expressions (9.05 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-06-25 12:25 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description m_a_riosv 2016-06-25 12:25:59 UTC
Created attachment 125898 [details]
Tes file to copy global local named expressions

https://wiki.documentfoundation.org/ReleaseNotes/5.2#Copying_named_expressions_and_ranges_while_copying_sheets

IMO when a sheet is copied to a new one, shouldn't create a copy of named expressions having global scope to one with local scope.

Name 	        Expression 	     Scope
global 	        $Sheet1.$A$1 	     Document (Global)
global 	        $NewSheet.$A$1 	     NewSheet XXXXXXXXXXXX -> not create
global_global 	global*100 	     Document (Global)
global_global 	global*100 	     NewSheet XXXXXXXXXXXX -> not create
global_local 	Sheet1.local*1000    Document (Global)
global_local 	local*1000 	     NewSheet XXXXXXXXXXXX -> not create
local 	        $Sheet1.$A$2 	     Sheet1
local 	        $NewSheet.$A$2 	     NewSheet
local_global 	global*10000 	     Sheet1
local_global 	global*10000 	     NewSheet
local_local 	Sheet1.local*100000  Sheet1
local_local 	local*100000 	     NewSheet

global 	        $NewSheet.$A$1 	     NewSheet
global_global 	global*100 	     NewSheet
global_local 	local*1000 	     NewSheet

Having a formula that has a named expression with global scope, what I expect when the cell is copied, is the references to the named expression (global) remaining without change, like happens doing an ordinary copy of cells between sheets.

I don't think it's fine allowing global and local expressions with the same name
Comment 1 royerjy 2016-06-26 07:39:10 UTC
I confirm with Build ID: 91f2f71e7b936c3c9fb984aaa01d432926abb38f on Linux 64 bits.
Comment 2 m_a_riosv 2016-06-26 20:44:25 UTC
Sorry, why highest and critical?
Comment 3 royerjy 2016-06-27 20:28:28 UTC
(In reply to m.a.riosv from comment #2)
> Sorry, why highest and critical?

Because it is impossible to use old spreadsheets using two kinds of names with the new version. In 5.1.4 they is a way to use old syntax : without sheet name prefix for local et with sheet name prefix for global, both define as global. I do not know how to do the same thing with the new feature as it is working. However, new feature is good if it works fine.
Comment 4 Eike Rathke 2016-07-22 13:17:54 UTC
(In reply to royerjy from comment #3)
Could you elaborate? A name with sheet prefix was not possible before 5.2, neither for global names nor for local names.
Comment 5 Eike Rathke 2016-07-22 13:24:34 UTC
(In reply to m.a.riosv from comment #0)
> IMO when a sheet is copied to a new one, shouldn't create a copy of named
> expressions having global scope to one with local scope.

Note that a global name is only copied to a local name if it references the same sheet that you are copying. This is because you're duplicating also the data it references.

> I don't think it's fine allowing global and local expressions with the same
> name

That's perfectly fine and also allowed in other spreadsheet applications.
Comment 6 Eike Rathke 2016-07-22 13:26:46 UTC
Actually there's no bug.
Comment 7 m_a_riosv 2016-07-22 21:01:00 UTC
(In reply to Eike Rathke from comment #5)
> (In reply to m.a.riosv from comment #0)
> > IMO when a sheet is copied to a new one, shouldn't create a copy of named
> > expressions having global scope to one with local scope.
> 
> Note that a global name is only copied to a local name if it references the
> same sheet that you are copying. This is because you're duplicating also the
> data it references.

I think I understand how it does, but if I want that behavior I can set the NamExp as local, so local is copied as local. But global copied as local, sorry I can't agree.

> 
> > I don't think it's fine allowing global and local expressions with the same
> > name
> 
> That's perfectly fine and also allowed in other spreadsheet applications.

IMHO only a source of mistakes.
Comment 8 royerjy 2016-07-23 04:48:34 UTC
(In reply to m.a.riosv from comment #7)
> (In reply to Eike Rathke from comment #5)
> > (In reply to m.a.riosv from comment #0)
> > > IMO when a sheet is copied to a new one, shouldn't create a copy of named
> > > expressions having global scope to one with local scope.
> > 
> > Note that a global name is only copied to a local name if it references the
> > same sheet that you are copying. This is because you're duplicating also the
> > data it references.
> 
> I think I understand how it does, but if I want that behavior I can set the
> NamExp as local, so local is copied as local. But global copied as local,
> sorry I can't agree.
> 
> > 
> > > I don't think it's fine allowing global and local expressions with the same
> > > name
> > 
> > That's perfectly fine and also allowed in other spreadsheet applications.
> 
> IMHO only a source of mistakes.

I agree with all m.a.riosv remarks. How can we use names in macros with this behaviour ?

May be is it necessary to adopt new rules, like : never, never, create global and local names in a sheet witch has to be copied  ? Is that already explain somewhere ? In this case, an alert would be helpful when copying a global name.

Global names must be created only in special sheets or directly in names.