Skip to main content

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

  • The Number parameter must be double.
  • The Decimalplaces parameter must be integer.
  • Use the IsNaN function to validate the parameters used are numbers.

Example

In an Expenses report Process, an employee registers 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 decimals (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 an Expenses report Process, an employee registers 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);