How to divide two variables defined in 2 functions

Hi everyone!
In this case i cant´t calculate the division of two variables defined in diferent functions. I want that my output will be a numeric (x/y).

How to resolve this problem?

image

In the first function (top left) i defined de variable x and the down i define the variable y.

image
image

But in the respective debugs appeears:

image
image

After that, i wont make a function that divide x/y and in last function i put this code:
image

And the output is:
image

So, what you sugest for i can divide x for y?

Messages won't show up at the same time so you will need to store the messages until you have both messages. Then you can retrieve them to do your math . There are several ways to do this Google flow.set or context.set for two ways and I'm sure someone will chime in with others.

Use global.set("x",x) to store the variable and use global.get("x") to get it

You also have to think about the case where two msgs go thru one function before a msg goes thru the second function. That could cause an incorrect result. You might be able to use a join node but not knowing what the flow prior to the two function nodes makes it hard to say.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.