Floor

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples > Perform Math operations >

Floor

Overview

This function rrounds a number down.

 

CHelper.Math.Floor(Number)

 

The parameter of this function can be defined as an XPath, variable or number.

 

Considerations

The 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.

Use the IsNaN function to validate the parameter is a number.

 

Example

In a Purchase Request Process an estimation of the price of a product is made based on the last three purchases of that product. The purchasing values are averaged to obtain the estimation. The Purchase department has decided to round this estimation down to obtain an integer estimation. For this case the Floor function can be used:

 

MAth21

 

//Obtain the estimated price by averaging the last three purchasing prices

EstimatedPrice = CHelper.Math.Average([<Product.Price1>,<Product.Price2>,<Product.Price3>]);

//Obtain the integer part of the estimated price

<Product.IntEstimatedPrice> = CHelper.Math.Floor(EstimatedPrice);