Skip to content
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

[feature] calculation node #18

Closed
gabrieligbastos opened this issue Sep 3, 2019 · 11 comments
Closed

[feature] calculation node #18

gabrieligbastos opened this issue Sep 3, 2019 · 11 comments

Comments

@gabrieligbastos
Copy link

hey @janober ,

does it make sense a calculation node?
something that would interact with data to transform it

i think would be something number_transform (with math operations)
string_transform (for string operations)

does it make sense?

@janober
Copy link
Member

janober commented Sep 3, 2019

Transformation nodes are definetly needed! Was not sure yet how they should work exactly, what they should do, how many should there be (one to do everything, different ones for numbers, strings, ..). Is probably worth checking out what other similar products like Node-Red, Zapier, Tray.io, parabola.io, integromat.com, ... are doing and what advantages and disadvantages it has.

If you have suggestions, ideas, ... would love to hear them! And if you are interested in implementing them even more.

@Libermentix
Copy link
Contributor

Wouldn't the more generic FunctionItem work for that? That's what we use internally primarily to do transformations of data.

@janober
Copy link
Member

janober commented Oct 10, 2019

Yes, it would work for sure but sadly only for people that can code. It should however also be possible for none coders to do as much as possible. So having a node/nodes in place which allows them to do that would be great.

@Libermentix
Copy link
Contributor

Libermentix commented Oct 11, 2019

@janober true that.

I just wonder how a calculation node would look like that does not include any code to do the calculation. If I understood the requirement correctly it would be something like: "I have an amount in cents and I want to transform it into an amount in euros (math operations)". But its not mentioned explicitly. Hence, the possibilities for interpretation would be endless. So in my opinion there would need to be some elaboration on the requirements on what should be done with that calculation node:

  • I need math operations to transform numbers from cents to Euros (i.e. implementation would be divide by 100 and have a parameter for the decimal precision) <-- math transformation
  • When I have an email field I want the characters to be masked <-- string transformation

To be clear it's my personal opinion, I would very much favor a user-friendly approach, but I asked myself, if I could get started on implementing that issue, how should the functionality look like and right now I wouldn't be able to answer that.

Would an idea be to look at how Zapier has implemented it, they have

  1. Numbers
  2. Datetime
  3. Text
  4. Utilities

@janober
Copy link
Member

janober commented Oct 11, 2019

haha yes, that is the problem I am neither ;-)

It could similar to the "Set" node. Where people can add multiple values (here operations). Then there could be one field for the "property name" which should be transformed and another one for the "transformation to transform".

Or not being a node at all. Just being different functions that people can use in expressions and select in a proper expression-editor (which I would love to have anyway, the current one simply needs to be improved!). I think Integromat does something similar.

@cyberpz
Copy link

cyberpz commented Nov 7, 2019

To anyone willing to solve in the meantime:
Learn basic operations on Strings and Numbers
on W3schools, using the funtionItem-node to transform your data in JS vanilla.

@Libermentix
Copy link
Contributor

Libermentix commented Nov 7, 2019

@Peppuz I think the biggest issue is not that people don't know Strings and Numbers (by the way w3schools is bad, use MDN instead please) but rather that n8n underlying data structure is not clear enough.

I for example know plenty of JS to get around with everything, however, understanding that you need to manipulate the item's .json property's containing object to actually yield a result, that was the biggest issue here.

@janober
Copy link
Member

janober commented Nov 7, 2019

I am actually right now in the process of writing documentation about how the data structure looks like and what variables and functions are available in the Function-Node.

@Libermentix
Copy link
Contributor

Amazing, that'll help greatly.

@janober
Copy link
Member

janober commented Nov 7, 2019

Ok created now some documentation.

Information about the data-structure, in general, can be found here:
https://docs.n8n.io/#/data-structure

Information about the Function-Nodes here:
https://docs.n8n.io/#/nodes?id=function-and-function-item-node

Hope it makes things a little bit clearer.

@RicardoE105
Copy link
Contributor

RicardoE105 commented Jun 3, 2020

Hey @gabrieligbastos, thanks for the feedback. You can go to our community https://community.n8n.io/ and request the calculation node.

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

5 participants