<< Click to Display Table of Contents >> Round |
Overview
This section describes Bizagi round number functions. These functions are as follows:
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:
//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);
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:
//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