Is Not a Number

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

Is Not a Number

Overview

This function checks if a parameter is not a number:

Returns true if the parameter is not a number.

Returns false if the parameter is a number.

 

CHelper.Math.IsNaN(Parameter)

 

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

 

Considerations

The supported attribute types to use as input XPath parameter (or Xpaths stored in variables) are: integer, currency, float, real.

 

Example

Suppose you want to evaluate if the parameters to be used in a Math function are numbers in order to avoid errors or incoherent results. To do so you can use the IsNaN function:

 

Math26

 

 

//Evaluate if of the parameters to be used in the average function are numbers

Number1IsNotaNumber=CHelper.Math.IsNaN(<Product.Price1>);

Number2IsNotaNumber=CHelper.Math.IsNaN(<Product.Price2>);

 

if (Number1IsNotaNumber==true || Number1IsNotaNumber==true)

{

//If not show an error message

CHelper.ThrowValidationError("The parameters of the Average function must be numbers");

}else{

//If so, apply the math function

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

}


Last Updated 1/6/2022 4:19:24 PM