Numeric Equation Functions

This article will provide the numeric equation field functions available to use and their definitions.

Notes:

  • The functions listed in this article are only available for equation fields. If you're looking for the functions available for text formula fields, see our article here.
  • The equation type must be set to "numeric" to use most of these functions.
  • Functions such as min and max can also be used in Date Equations.

 

Many regular math functions (such as "ceil" or "max") can be used in Knack numeric equations. Others, such as getDateDayOfMonth provide numeric values for a date.

Name Description

Example with Result

 abs

 Calculates the absolute value of a number

 abs(3.85) = 4

cbrt

Calculate the cube root of a number

cbrt(27) = 3

ceil

Round a value up to the nearest integer

ceil(4.2) = 5

cos

Calculate the cosine of a number

cos(2) = -0.4161468365471424

 factorial

Compute the factorial of a number

factorial(5) = 120

 floor

 Round a value down to the nearest           integer 

  floor(2.8) = 2

 gcd

Calculate the greatest common denominator of a comma-separated list of numbers

gcd(5, 25) = 5

log

Calculate the logarithm of a number. The first number is the value for which to calculate, the second is the base.

log(10,4) = 1.6609640474436813

log10

Calculate a base 10 logarithm. Same as log(x, 10)

log10(4) = 0.6020599913279623

max

Get the maximum of a comma-separated list of values

max(1,6,9) = 9

mean

Compute the mean of a list of values

mean(1,6,8) = 5

median

Compute the median of a list of values

median(8,9,1) = 8

min

Get the minimum of a list of values

min(43,100,3) = 3

pow

Calculate the base to the exponent power

pow(7,2) = 49

random

Get a random number between two values

random(1,42) = 36.238172

randomInt

Get a random integer between two values

randomInt(1,42) = 36

 round

 Rounds the first number to the   precision of the second number

round(5.5,3) = 6

sign

Calculate the sign of a number: -1 if the number is less than 0, 1 if the number is greater than 0, 0 if the number is 0

sign(2) = 1

sin

Calculate the sine of a number

sin(15) = 0.6502878401571168

std

Compute the standard deviation of a list of values

std(1,5,42,78) = 36.07861785970558

sqrt

Calculate the square root of a number

sqrt(81) = 9

sum

Compute the sum of a list of values

sum(1,42,56) = 99

tan

Calculate the tangent of a number

tan(16) = 0.3006322420239034

var

Compute the variance of a list of values

var(1,42,34,67) = 742

netWorkDays

Get the number of working/business days between two dates

netWorkDays(06/18/2018,06/27/2018) = 7

Note: The netWorkDays function calculates the total number of working days between two dates, considering only Monday to Friday.

If your dates include time, it does not take into account working hours (e.g. 9 am-5 pm). The function only will count for a full 24-hour day. 

 

The following examples use April 15, 2017, as the date:

getDateDayOfWeek

Get the numeric day of the week from a Date (Sunday = 1)

getDateDayOfWeek({Date}) = 7

getDateDayOfMonth

Get the numeric day of the month from a Date

getDateDayOfMonth({Date}) = 15

getDateWeek

Get the numeric week of the year from a Date

getDateWeek({Date}) = 15

getDateMonth

Get the numeric month from a Date

getDateMonth({Date}) = 4

getDateQuarter

Get the numeric quarter from a Date

getDateQuarter({Date}) = 2

getDateYear

Get the numeric year from a Date

getDateYear({Date}) = 2017