Module

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

Module

 

Overview

This function returns the remainder after a number is divided by a divisor.

 

CHelper.Math.Module(Number,Divisor)

 

The parameters of this function can be defined as Xpaths, variables or numbers.

 

Considerations

Input parameters must be integers.

The supported attribute type to use as input XPath parameter (or Xpaths stored in variables) is integer.

The function returns an error if the Divisor is equal to 0.

Use the IsNaN function to validate the parameters used are numbers.

 

Example

Suppose in a Process it has to be evaluated if a number is pair. To do so you can use the Module function using the number 2 as the divisor. If the result obtained is equal to 0 then the number is pair.

 

Math19

 

//Obtain the Module of the number using 2 as divisor

Module= CHelper.Math.Module(<Process.NumbertoEvaluate>,2)

//Evaluate if the result is equal to 0

if (Module==0)

{

//If so the number is pair

<Process.IsPair>= true;

}else

{

//If not the number is not pair

<Process.IsPair>= false;

}


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