How to do math calculations inside your bot?
In this article
1. Example1: Performing (A+B)*(A-B) calculation
2. Operators:
3. Functions:
4. Constants:
5. Others:
Yes, You can.
Not only the basic calculations like addition, subtraction, multiplication, or division. You can build complex mathematical and scientific calculations (the functions are mentioned below) in the Chumchat platform.
We’ll show you how it can be done with some examples.
Follow the steps to know how to make calculations inside your chatbot.
Step 1: Choose the Flow you want to include calculation operations.
Step 2: Select Action on the block builder and choose Set Custom Field.
Step 3: Select the “custom field” on the flow and set up the wizard by choosing the existing custom field (Which you stored the values as number) and choose to use a custom formula on the operation, then set the custom formula that you want on the Value field.
Step 4: Then save, that’s it.
We know that it might confuse you a bit, let me explain this procedure with one simple example.
Example1: Performing (A+B)*(A-B) calculation
Get the values of A & B from user input as numbers,
Now set the calculation formula on the flow. For that, choose action on the basic builder and select the set custom field. Then, setup the wizard by choosing the custom field (number) in which you want to store the calculated values (here, we created that as “calculation value”).
Now, the interesting part. Set the formula on the Value field (here we used the formula ( {{{value a}}-{{{value b}} )*({{value a}}+{{value b}} ) to do the above said calculation.
That’s it, if you take A as 4 and B as 2, the result will be shown by a chatbot as 12 (as per the calculation).
Here are some basic math examples that you can do inside the SiFer Bots platform:
Here are some basic math examples that you can do inside the SiFer Bots platform:
1+2*3-4
1 + 2 * 3 – 4
pi * 2
PI * 2
abs(1) + min(1,2) * max(1,2,3)
min(1+2, abs(-1))
1 + ((2 – 3) * (5 – 7))
2 * (-3)
Here is the example of formats with syntax:
1 // A term can consist of just a number
(1+((2))) // Usage of obsolete brackets is allowed
00001 // Prefixing a number with obsolete zero digits is possible
.1 // Omitting a zero digit before a period character is okay
Here are some awesome list to provide more value for this article:
Operators:
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Functions:
abs
aCos
aCosH
aSin
aSinH
aTan
aTanH
aTanTwo
ceil
cos
cosH
degToRad
en
exp
expMOne
floor
fMod
hypot
log
logOneP
logTen
max
min
pow
radToDeg
round
sin
sinH
sqrt
tan
tanH
Constants:
e
euler
lnPi
lnTen
lnTwo
logTenE
logTwoE
onePi
pi
piFour
piTwo
sqrtOneTwo
sqrtPi
sqrtThree
sqrtTwo
twoPi
twoSqrtPi
Others:
( (right-faced brackets)
) (left-faced brackets)
, (comma)
. (dot)
Is this article helpful?
Articles in this section:
- How to get started?
- How to Provide your Own Translations on Built-in Flows?
- Core components of your bot
- How can I change the Default reply?
- How can I change the Welcome message?
- Custom Field
- Tags
- Overview
- How Can I Enable/Disable Message Composer Automatically?
- How to Enable/Disable Message Composer on the flow?
- How can I format date & time?
- How to use External Requests / Dynamic Contents?
- How to send random messages to the users?
- How can I Enable Notify Admins Feature?
- How to send an image/video/file to the users?
- How to create a collection of flow?
- Mailerlite
- PayPal
- General Settings
- Persistent Menu
- Icebreaker
- Greeting Message
- Bot Profile
- Default Reply
- Welcome Message
- GetResponse
- Integromat
- Klaviyo
- Pipedrive
- Platformly
- Zapier
- Truemail
- MooSend
- ActiveCampaign
- MailChimp
- Facebook Ads Integration
- Google Sheets Integration
- Stripe
- How to see all receive messages without a response?
- Get my Chatbot Link
- Analytics – Sales
- New Users Analytics
- How to import subscribers from other bot Platforms?
- How can I export PSIDs?
- How can I enable/disable live chat?
- How I can manually tag a user?
- How to see user information?
- Checkout Settings
- Shipping Settings
- Payment Settings
- Category
- Overview (Ecommerce)
- Delivery Cost based on Location
- Can I change the Symbol of money ($) on my product?
- How to disable the order updates notification?
- How to change the currency of my product?
- How to limit the minimum order value?
- How to set open hours for orders?
- How to enable Pickup on the store option?
- How to change payment methods?
- Add/Edit a Product
- Enable Cash on Delivery
- How to send a broadcast message?
- How to send messages on my user’s own timezone?
- Bot links and Ref Referral Parameters (m.me)
- QR Code Generator
- Facebook Comments
- Cancel Pro Subscription
- What is the OTN (One Time Notification)
- How to do math calculations inside your bot?
- Create Templates
- Triggers and Actions
- GDPR Compliance
- How to get the JSON code for Facebook Ads?
- Set up a Poll with Messenger Chatbot
- What is the maximum file/video size?
- Copy Flow to Another Page
- Where I can find templates?
- How to share a product on another medium?