-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Unexpected return value when expression uses an array length in a function #5226
Comments
Hey @NoOverflow, Thanks for reporting this one, I must be missing something as I can see the result is wrong in your screenshot but when I run a workflow to try and reproduce it is running as expected. ... As I was about to post this I just noticed I was using I have created |
Hey @Joffcom, thanks for checking it so quickly. Can confirm, length() does work (I don't know why I didn't try that first...) |
Hey @NoOverflow, Good news, The fix for this has been merged (#5232) and will be available in the next release. I am going to get this one marked as closed for now 👍🏻 thanks again for the report. |
Fix got released with |
Hi, I'm not sure if this is a duplicate (I've looked into open issues but couldn't find a close match), or if this issue comes from a misunderstanding on how to use n8n but I still find it weird.
Describe the bug
When using the length of an array set in a previous node, in a function (such as Math.floor), in an inline expression, the return value will always be equal to the actual length no matter what the expression is supposed to do. Hardcoding the length results in expected behaviour.
To Reproduce
(Example workflow provided as attachment for convenience)
my_array
Expected behavior
An expression should be able to contain the dynamic length of an array
Environment (please complete the following information):
Additional context
I attached the test workflow for convenience, however it's lacking the n8n test data, you can just add a dummy array containing a few values.
workflow.zip
The text was updated successfully, but these errors were encountered: