<< Click to Display Table of Contents >> Percentage |
Overview
This function returns the equivalent in percentage of a number.
CHelper.Math.Percentage(Number)
The parameter of this function can be defined as an XPath, variable or number.
Considerations
•Input parameter must be double.
•The supported attribute types to use as input XPath parameter (or Xpaths stored in variables) are: integer, currency, float, real.
•The function returns error if the input parameter is either too long or undefined.
•Use the IsNaN function to validate the parameter is a number.
Example
In a Credit request process the information of interest rates is entered and displayed in Forms as numbers between 0 and 100. Suppose in an activity of the Process the interest amount caused in one period must be calculated. The process cannot use this number to perform the calculation so it must be normalized into a number between 0 and 1 to obtain a coherent and accuracy result. To do that in Bizagi you can use the Percentage function:
//Obtain the Interest rate (Between 0 and 1)
RealInterestRate = CHelper.Math.Percentage(<CreditRequest.InterestRate>);
//Calculate the Interest amount
<CreditRequest.InterestAmount> = RealInterestRate * <CreditRequest.RequestedAmount>;
Last Updated 1/6/2022 4:19:51 PM