Basic math expression of x and y

(Dezio) #1

Hello,
I don’t have much experience on using bot and math.js and I don’t know how to start a basic calculation.

I would like that when I enter x and y the bot responds with the solution.

example:

me: x y
bot: execute expression like this

math.eval(‘x * x’) / 162 * y

and print the result

Is there a fast way to do that?

(Karen Barker) #2

Hi Dezio,

We have a built in Number function which could be used to input the formula as above changing the values of x and y to the equivalent inputs from previous tasks in the bot. :slight_smile:

(Dezio) #3

Hi Karen can you make an example with few screenshots?

(Karen Barker) #4

Hi @Dezio,

There’s a flow here you can install which should show you how to achieve this. Thanks :slight_smile:

1 Like
(Dezio) #5

Ok great thanks!
Last question, how can I add a numeral (or something like this) for formatting results like 0,00?
I found this but I don’t know how to implement.

var string = numeral(1000).format(‘0,0’);

(Karen Barker) #6

Hi Dezio,

You’ll just need to add a “Format Number” action after the calculate action. I’ve updated the previous shared flow to show this, so if you just install the flow again you should see the changes. :slight_smile:

1 Like
(Dezio) #7

Great thank you so much :slight_smile: