Skip to content

UPPER() not implemented #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
gflohr opened this issue Apr 6, 2025 · 2 comments
Open

UPPER() not implemented #66

gflohr opened this issue Apr 6, 2025 · 2 comments

Comments

@gflohr
Copy link

gflohr commented Apr 6, 2025

The function LOWER() works as expected, UPPER() does not:

error: Function UPPER is not implemented.

@michaeltford
Copy link
Collaborator

michaeltford commented Apr 6, 2025

Hmm, can you provide more detail? The function exists and the (single) unit test passes.

@gflohr
Copy link
Author

gflohr commented Apr 9, 2025

A stripped-down example from the README reproduces the problem:

import FormulaParser from 'fast-formula-parser';

const data = [
	// A  B  C
	['foo', 'bar', 'baz'], // row 1
];

const parser = new FormulaParser({
	// retrieve cell value
	onCell: (arg) => {
		return data[arg.row - 1][arg.col - 1];
	},
});

const position = { row: 1, col: 1, sheet: 'Sheet1' };

console.log(parser.parse('LOWER(Shee1!A1)', position));
console.log(parser.parse('UPPER(Shee1!A1)', position));

I've also seen that UPPER is implemented and that it looks exactly the same as LOWER except for the case conversion function. I have no idea why one works and the other does not.

For completeness, this is the output of the script:

$ node zzzformula.mjs
foo
/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/formulas/error.js:138
    return new FormulaError('#ERROR!', msg, details);
           ^

#ERROR!: Function UPPER is not implemented.
    at FormulaError.ERROR (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/formulas/error.js:138:12)
    at FormulaParser.parse (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/grammar/hooks.js:307:32)
    at file:///Users/guidoflohr/javascript/e-invoice-eu/packages/core/zzzformula.mjs:18:20
    at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:547:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5) {
  _error: '#ERROR!',
  details: #NAME?: Function UPPER is not implemented.
      at FormulaError.NOT_IMPLEMENTED (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/formulas/error.js:105:12)
      at FormulaParser._callFunction (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/grammar/hooks.js:191:32)
      at FormulaParser.callFunction (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/grammar/hooks.js:208:30)
      at Parsing.<anonymous> (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/grammar/parsing.js:299:43)
      at RecognizerApi.ACTION (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js:22:21)
      at Parsing.<anonymous> (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/fast-formula-parser/grammar/parsing.js:299:22)
      at Parsing.invokeRuleWithTry (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:118:33)
      at Parsing.wrappedGrammarRule [as functionCall] (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:132:38)
      at RecognizerEngine.subruleInternal (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js:423:37)
      at RecognizerApi.SUBRULE (/Users/guidoflohr/javascript/e-invoice-eu/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js:73:21) {
    _error: '#NAME?',
    details: undefined
  }
}

Node.js v22.13.1
$ node --version     
v22.13.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants