Built-in Functions
Introduction
This guide explains what built-in functions there are in Rulecube and how to use them.
Rulecube has many built-in functions ready to use for you and grouped them into these categories:
- Global 
- Finance 
- HTTP 
- Mail 
- MongoDB 
- SQL 
- Statistics 
- Workflow 
- System 
- Array 
- Date 
For example, in the Finance group, you have the pv function for calculating the present value of a loan or investment. And in the Statistics group, you'll find the mean and median functions. 
To discover what's available, the best way is to click on the  icon and then on "Documentation". This will open the Rulecube Manual.
 icon and then on "Documentation". This will open the Rulecube Manual.
Alternatively you can access this Manual from any code editor, like when editing a Rule:

Procedure
Let's say you want to calculate the VAT amount from an amount that includes the VAT. The resulting VAT amount can have several decimal places, but for a neat presentation, you want to limit the decimal places to two. Rulecube has the ROUND function for this:
- Create a ruleset named - VAT_calculator.
- Create an input named - AmountIncludingVATand set its Type to- number.
- Create a rule named - ExtractVATand set its Type to- numberand the Expression to:- ROUND(AmountIncludingVAT / 121 * 21, 2)
- Click Save and click Try it out to test the ruleset.