Round

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Math operations, strings and data validations > Perform Math operations >

Round

Overview

This section describes Bizagi round number functions. These functions are as follows:

Round(Number,Decimalplaces)

Round()

 

Round(Number,Decimalplaces)

This function reduces a given number to a specific number of decimal places.

 

CHelper.Math.Round(Number,Decimalplaces)

 

The parameters of this function can be defined as Xpaths, variables or numbers.

 

Considerations

Number parameter must be double.

Decimalplaces parameter must be integer.

Use the IsNaN function to validate the parameters used are numbers.

 

Example

In a Expenses report Process an employee register all the expenses of a business trip. As the expenses can be entered in a currency different from the local currency a conversion has to be made. According to the exchange rate the amount obtained can contain many decimal places which are not significant. To round this amount to one with a significant number of decimal (let us say two) you can use the Round function:

 

Math27

 

//Calculate the expenses in local currency

ConvertedExpenses = <ExpensesReport.ReportedExpenses>*<ExpensesReport.ExpensesCurrency.ExchangeRate>;

//Round the expenses amount to a significant number of decimals

<ExpensesReport.TotalExpenses> = CHelper.Math.Round(ConvertedExpenses,2);

 

Round(Number)

This function rounds a number to the nearest integer.

 

CHelper.Math.Round(Number)

 

The parameters of this function can be defined as Xpaths, variables or numbers.

 

Considerations

Use the IsNaN function to validate the parameters used are numbers.

 

Example

In a Expenses report Process an employee register all the expenses of a business trip. As the expenses can be entered in a currency different from the local currency a conversion has to be made. According to the exchange rate the amount obtained can contain many decimal places which are not significant. To round this amount to one without any decimals, you can use the Round function:

 

Math28

 

//Calculate the expenses in local currency

ConvertedExpenses = <ExpensesReport.ReportedExpenses>*<ExpensesReport.ExpensesCurrency.ExchangeRate>;

//Round the expenses amount without decimals

<ExpensesReport.TotalExpenses> = CHelper.Math.Round(ConvertedExpenses);


Last Updated 1/6/2022 4:20:07 PM