hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

Named expression on format "HF2_2" not allowed

Open jboysen opened this issue 3 years ago • 3 comments

But there is not information about why, and the naming doesn't violate the rules mentioned here: https://hyperformula.handsontable.com/guide/named-expressions.html#naming-convention

A jsfiddle to illustrate the issue: https://jsfiddle.net/uk1djxpw/1/

jboysen avatar Sep 07 '22 10:09 jboysen

Hi, @jboysen. I am sorry you experienced an issue with HyperFormula. You are right, the naming rules for named expressions must be updated. Thank you for reporting it.

sequba avatar Sep 07 '22 11:09 sequba

The implementation of isNameValid indicates that the name is valid: https://github.com/handsontable/hyperformula/blob/fd0a40581d1dea2a19c2307228825ad0c3b6dedb/src/NamedExpressions.ts#L161-L166

Is the implementation incorrect?

jboysen avatar Sep 07 '22 21:09 jboysen

It might be incorrect or there is something else going on here. Our team will investigate this issue shortly.

sequba avatar Sep 08 '22 09:09 sequba

Also, the heading Naming convention in our named expressions guide is very misleading. What this section describes is not a convention. These are the requirements for a valid name of the expression. @kirszenbaum proposed to change the heading to Custom name rules.

sequba avatar Nov 09 '22 10:11 sequba

Note to myself: Based on the case https://jsfiddle.net/h93ak8pL/1/, update the forum topic at https://forum.handsontable.com/t/gh-hyperformula-1058-named-expression-is-not-working/6569

AMBudnik avatar Nov 09 '22 11:11 AMBudnik

I see now the title changed of this issue. We looked more into this, and found that "HF2_2" is problematic, but "HF_2" was not, so the title is now misleading.

For now we solved it by checking our named expressions like this in a validate method:

if (/^[A-Z]+\d+/ig.test(variable)) {
    return false;
}

jboysen avatar Nov 09 '22 11:11 jboysen

@jboysen Thank you for your input. It will come in handy in the process of working on this issue.

sequba avatar Nov 09 '22 11:11 sequba

Possible duplicate: #880

sequba avatar Nov 10 '22 15:11 sequba

@jboysen,

I'm more than happy to announce that we just released HyperFormula 2.3.1 where this issue is fixed. We are closing this issue as solved. If there is anything that won't work for you after updating, please leave a comment.

sequba avatar Mar 03 '23 10:03 sequba

Because HF can handle more columns than Excel something like AUFRINGES1 named range expression is invalid in HF but not Excel. How about if we set MaxColumns to say 26 or max Excel columns could you only do the named range check up to that column for compatibility?

kevinplummer avatar Mar 14 '23 06:03 kevinplummer

Hi @kevinplummer that's an interesting idea. But at the moment, it is not available out of the box. If you'd like to test a custom solution and create a pull request we would be more than happy to review it as at the moment we focus more on fixing issues than on providing new functionalities.

AMBudnik avatar Mar 14 '23 13:03 AMBudnik