This article will provide example numeric Equation field functions to use.
This information is referenced in the Equations article.
Note: The functions listed on this page are only available for Equation Fields. If you're looking for the functions available for Text Formula fields, click here.
- The equation type must be set to "numeric" to use 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 |
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 |
gcd |
Calculate the greatest common denominator of a comma-separated list of numbers |
gcd(5, 25) = 5 |
log |
Calculate the logarithm of a number. First number is value for which to calculate, 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 |
sign |
Calculate the sign of a number: -1 if number is less than 0, 1 if number is greater than 0, 0 if 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 |
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 |