Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

LEN method returns wrong result with an empty values #117

Open
nikita-prtsr opened this issue Jun 21, 2023 · 3 comments
Open

LEN method returns wrong result with an empty values #117

nikita-prtsr opened this issue Jun 21, 2023 · 3 comments

Comments

@nikita-prtsr
Copy link

I have a problem:

const context = {
  name: null
}
expect(axel.compile('LEN(name)')(context)).toEqual(0) // error here with result - 4

I found that it is because of converting of nil values to "NULL" string instead of "" an empty string in case of excel functions which accepts string as an argument.

I've found that the excel-string function used in LEN func implementation and guessing that we should add an additional (if (nil? text) "" text) to avoid nil in excel-string function call.

What should I do?
It would be nice if you adjust the LEN function to accept nil values as an "" empty string instead of "NULL" string.

@zarkone
Copy link
Contributor

zarkone commented Jun 21, 2023

sounds fare, I think.

I also found that LEN also works on numbers in gdocs:
1687335580-21-06-23_10:19:40

when in axel-f it is always 4 for numbers because of the same reason

@nikita-prtsr
Copy link
Author

@zarkone So would it be better to add more conditions for argument type of LEN implementation?

@zarkone
Copy link
Contributor

zarkone commented Jun 21, 2023

I think it makes sense 👍

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

No branches or pull requests

2 participants