Bug 112279 - EDITING: Improve error text when adding named cells
Summary: EDITING: Improve error text when adding named cells
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.4.1.2 release
Hardware: All All
: lowest trivial
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0
Keywords: difficultyBeginner, easyHack
Depends on:
Blocks: Error-Messages
  Show dependency treegraph
 
Reported: 2017-09-07 16:24 UTC by Emil Tanev
Modified: 2023-05-12 19:29 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
error message (66.57 KB, image/png)
2017-09-07 16:24 UTC, Emil Tanev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emil Tanev 2017-09-07 16:24:34 UTC
Created attachment 136099 [details]
error message

Open a new spreadsheet
Open Manage Names from the Named cells dropdown
Click Add
In the Name field, add "1"
https://www.screencast.com/t/8SWty0FRoV

Issue: An error message is displayed in blue:
Invalid name. Only use letters, numbers and underscore

The error is displayed as soon as one adds "1", which is a number and is suggested as correct in the error message.
Comment 1 Eike Rathke 2017-09-07 17:12:34 UTC
How much prose do you want in one line? The name can not be a number, not something that could be a cell reference in any of the possible reference styles, and it can't start with a digit, which here is the case.
Comment 2 Buovjaga 2017-09-11 05:56:03 UTC
Emil: please propose a smashing new one-liner per Eike's parameters.
Comment 3 Emil Tanev 2017-09-11 06:55:43 UTC
Depending on the expected behavior:
Invalid name. Only use letters, numbers and underscore in this order. 
Or:
Invalid name. Only use letters, numbers and underscore, starting with a letter.
Comment 4 QA Administrators 2018-09-14 02:47:51 UTC Comment hidden (obsolete)
Comment 5 Timur 2020-03-20 10:36:19 UTC
Repro 70+.
Comment 6 Mike Kaganski 2020-09-19 10:47:56 UTC
The dialog obviously applies too much restriction. E.g., it's possible to use names like "a,b" (i.e., with comma) - just type that into the Name Box above the cells; but the dialog has that odd restriction. IMO it should be fixed to match the actual restriction first, then the message should be fixed.
Comment 7 Mike Kaganski 2020-09-19 11:10:36 UTC
Additionally, you may start with e.g. underscore. So I suppose that you can't come with a single error message short enough. The dialog possibly could try to be smart enough to show different error messages based on the specific problem - like "The name can't start with a digit"; "The name entered is a cell reference"; ...
Comment 8 Commit Notification 2020-09-26 15:27:45 UTC
Roman Kuznetsov committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/949d648594f441dbb7e9c600d7925fba7e882ff9

tdf#112279 Change the error message to more clear

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.
Comment 9 BogdanB 2023-05-10 14:54:35 UTC
Roman, is this bug solved?
Comment 10 ady 2023-05-11 16:29:31 UTC
(In reply to Mike Kaganski from comment #7)
> Additionally, you may start with e.g. underscore.

FWIW, that is not what the error message currently says:

https://git.libreoffice.org/core/+/refs/heads/master/sc/inc/globstr.hrc

NC_("STR_ERR_NAME_INVALID", "Invalid name. Start with a letter, use only letters, numbers and underscore.")
Comment 11 BogdanB 2023-05-11 18:45:47 UTC
How do you think about this?

NC_("STR_ERR_NAME_INVALID", "Invalid name. Start with a letter or an underscore, and use only letters, numbers and underscore.")
Comment 12 ady 2023-05-11 20:57:05 UTC
(In reply to BogdanB from comment #11)
> How do you think about this?
> 
> NC_("STR_ERR_NAME_INVALID", "Invalid name. Start with a letter or an
> underscore, and use only letters, numbers and underscore.")

The problem is that the name cannot start with a number nor be equivalent to an address (in any form) either, and the message has to be short.

Starting always with an underscore would solve these naming conflicts, but Calc should not impose that.

While not completely imposing the underscore as first character, the short message could still hint such naming method as a simple solution for those cases that trigger some naming conflict.

I do not know whether the possible conflict with cell address (A1 or R1C1 or R[1]C[1], although brackets are not allowed) is also expected to be handled by the same message, or there is a separate one for that instead.


So, some possibilities I write here for discussion (attention to the order of terms):


1. Use only underscores, digits and letters. Do not start with digit. Cell address not allowed.

2. Use only underscores, digits and letters. Do not start with digit. Avoid cell address.

3. Use only underscores, digits and letters. Do not start with digit.

4. Use only "_", digits and letters. Do not start with digit.

5. Use only "_", [1-9] and letters. Do not start with digit.

6. Use only "_", [1-9] and letters. Do not start with digit. Avoid cell address.

7. Use only "_", [1-9] and letters. Do not start with digit. Cell address not allowed.



The first alternative covers more and is more clear, but longer (92 chars).

The third alternative is shorter (66 chars), in case the conflict with cell addresses is handled by a separate message – I don't know the answer to that.

Others are compromises in some way or another, with different lengths.
Comment 13 BogdanB 2023-05-12 03:46:34 UTC
I like "3. Use only underscores, digits and letters. Do not start with digit." but with numbers instead of digits: "3. Use only underscores, numbers and letters. Do not start with numbers."
Comment 14 ady 2023-05-12 09:55:51 UTC
(In reply to BogdanB from comment #13)
> I like "3. Use only underscores, digits and letters. Do not start with
> digit." but with numbers instead of digits: "3. Use only underscores,
> numbers and letters. Do not start with numbers."

"Digit" is shorter than "number", and plural is not needed (nor wanted) at the end of that sentence. That's why :). I don't know what's the acceptable length for the (English) message.

The point about cell addresses is also relevant. Is that part handled by some other message? If it isn't, and if the length is not a problem for alternative 1, I would go with it:

Use only underscores, digits and letters. Do not start with digit. Cell address not allowed.

If the cell address point is not handled by some other message and the length is a problem for alternative 1, then alternative 7:

Use only "_", [1-9] and letters. Do not start with digit. Cell address not allowed.

or:

Use only "_", 1...9 and letters. Do not start with digit. Cell address not allowed.

It all depends on the restrictions, which I don't know.
Comment 15 Mike Kaganski 2023-05-12 11:03:22 UTC
(In reply to BogdanB from comment #13)
> numbers instead of digits

Please do not confuse "numbers" (anything like e.g. "123" or "0.15*10^-123") with "digits" (= symbols used do represent the math decimal notation elements). Indeed, the "decimal" is implied, and we also do not consider e.g. Chinese 一二三.
Comment 16 Mike Kaganski 2023-05-12 11:07:01 UTC Comment hidden (obsolete)
Comment 17 ady 2023-05-12 13:28:37 UTC
(In reply to Mike Kaganski from comment #16)
> "12f" is gladly accepted when assigned using
> the Name Box of main UI.

It is rejected for me.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: daf30c29be67b8b8fa361b0efd1a6cdbe087b6f8
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: en-US (es_AR); UI: en-US
Calc: CL threaded
Comment 18 Mike Kaganski 2023-05-12 19:29:24 UTC Comment hidden (obsolete)