Field - Formula

Field - Formula

Explore Layer's formula capabilities for date, text, and math functions. Learn how to use DATE, CONCATENATE, ROUND, and more to enhance your data calculations.

Silvia Lee

Number

ABS(value)

  • value – The number to return the absolute value for.

ADD(value1, value2, ...)

  • value1, value2, ... – Two or more numbers to add together.

CEILING(value)

  • value – The number to round up to the nearest integer.

DATE(value)

  • value – A value to convert into a date.

DIVIDE(dividend, divisor)

  • dividend – The number to be divided.

  • divisor – The number to divide by.

EQUALS(value1, value2)

  • value1, value2 – Values to compare. Inputs must be the same type.

EXP(value)

  • value – The exponent to raise e to.

FLOOR(value)

  • value – The number to round down to the nearest integer.

GT(value1, value2)

  • value1, value2 – Checks if the first number is greater than the second.

GTE(value1, value2)

  • value1, value2 – Checks if the first number is greater than or equal to the second.

INT(value)

  • value – Converts a number to an integer by truncation.

LOG(value)

  • value – Returns the natural logarithm of a number.

LT(value1, value2)

  • value1, value2 – Checks if the first number is less than the second.

LTE(value1, value2)

  • value1, value2 – Checks if the first number is less than or equal to the second.

MOD(dividend, divisor)

  • dividend – The number to divide.

  • divisor – The divisor.

  • Returns the remainder.

MULTIPLY(value1, value2, ...)

  • value1, value2, ... – Two or more numbers to multiply together.

NOTEQUALS(value1, value2)

  • value1, value2 – Checks if two values are not equal.

POWER(base, exponent)

  • base – The base number.

  • exponent – The power to raise the base to.

ROUND(value, precision)

  • value – The number to round.

  • precision – Number of decimal places.

ROUNDDOWN(value, precision)

  • value – The number to round down.

  • precision – Number of decimal places.

ROUNDUP(value, precision)

  • value – The number to round up.

  • precision – Number of decimal places.

SQRT(value)

  • value – The number to return the square root of.

SUBTRACT(value1, value2)

  • value1 – The starting number.

  • value2 – The number to subtract.

TOSTRING(value)

  • value – Converts a value to a string.

Boolean

AND(value1, value2, ...)

  • value1, value2, ... – Checks if all values are true.

EQUALS(value1, value2)

  • value1, value2 – Checks if two values are equal.

NOT(value)

  • value – Negates a boolean value.

NOTEQUALS(value1, value2)

  • value1, value2 – Checks if two values are not equal.

OR(value1, value2, ...)

  • value1, value2, ... – Checks if any value is true.

TOSTRING(value)

  • value – Converts a boolean value to a string.

List

ARRAY(value1, value2, ...)

  • value1, value2, ... – Creates an array from values of the same type.

ARRAYAT(array, index)

  • array – The array to access.

  • index – The index to retrieve.

ARRAYJOIN(array)

  • array – Joins an array of strings into a single string.

ARRAYLENGTH(array)

  • array – Returns the number of items in an array.

AVERAGE(array)

  • array – Calculates the average of numerical values.

COUNTEMPTY(array)

  • array – Counts empty values.

COUNTNOTEMPTY(array)

  • array – Counts non-empty values.

FIRST(array)

  • array – Returns the first value in an array.

LAST(array)

  • array – Returns the last value in an array.

MATRIXMULTIPLY(array1, array2)

  • array1, array2 – Multiplies arrays element-wise.

MAX(array)

  • array – Returns the largest number.

MEDIAN(array)

  • array – Returns the median value.

MIN(array)

  • array – Returns the smallest number.

PRODUCT(array)

  • array – Multiplies all numbers together.

RANGE(array)

  • array – Returns the difference between highest and lowest values.

SUM(array)

  • array – Sums all numerical values.

UNIQUE(array)

  • array – Consolidates equivalent values and tracks quantity.

String

CONCATENATE(text1, text2, ...)

  • Text values must be wrapped in ' '

  • Use commas to separate values.

DATE(value)

  • value – Converts a value to a date.

ENCODEURICOMPONENT(text)

  • text – Encodes a string for use in a URL.

EQUALS(value1, value2)

  • value1, value2 – Checks if two strings are equal.

LEFT(text, length)

  • text – The string to extract from.

  • length – Number of characters.

LENGTH(text)

  • text – Returns number of characters.

LOWER(text)

  • text – Converts text to lowercase.

MID(text, start, length)

  • text – The string to extract from.

  • start – Starting position.

  • length – Number of characters.

NOTEQUALS(value1, value2)

  • value1, value2 – Checks if strings are not equal.

REGEXEXTRACT(text, pattern)

  • text – The input string.

  • pattern – Regular expression.

REGEXMATCH(text, pattern)

  • text – The input string.

  • pattern – Regular expression.

REGEXREPLACE(text, pattern, replacement)

  • text – The input string.

  • pattern – Regular expression.

  • replacement – Replacement string.

REPEAT(text, count)

  • text – The string to repeat.

  • count – Number of repetitions.

RIGHT(text, length)

  • text – The string to extract from.

  • length – Number of characters.

SEARCH(text, search_text)

  • text – The string to search.

  • search_text – Text to find.

SUBSTITUTE(text, old, new)

  • text – Original string.

  • old – Text to replace.

  • new – Replacement text.

TRIM(text)

  • text – Removes whitespace.

UPPER(text)

  • text – Converts text to uppercase.

Date

DATEADDDAYS(date, days)

  • date – The starting date.

  • days – Number of days to add.

DATEADDHOURS(date, hours)

  • date – The starting date.

  • hours – Number of hours to add.

DATEADDMINUTES(date, minutes)

  • date – The starting date.

  • minutes – Number of minutes to add.

DATEADDMONTHS(date, months)

  • date – The starting date.

  • months – Number of months to add.

DATEADDSECONDS(date, seconds)

  • date – The starting date.

  • seconds – Number of seconds to add.

DATEADDWEEKS(date, weeks)

  • date – The starting date.

  • weeks – Number of weeks to add.

DATEADDYEARS(date, years)

  • date – The starting date.

  • years – Number of years to add.

DATEISAFTER(date1, date2)

  • Checks if the first date is after the second.

DATEISBEFORE(date1, date2)

  • Checks if the first date is before the second.

DATEISSAME(date1, date2)

  • Checks if two dates are the same.

DAY(date)

  • Returns the day of the week as a number (0–6, Sunday–Saturday).

HOUR(date)

  • Returns the hour of the day.

ISWEEKDAY(date)

  • Checks if a date is Monday–Friday.

ISWEEKEND(date)

  • Checks if a date is Saturday or Sunday.

MONTH(date)

  • Returns the month (0–11, January–December).

WEEK(date)

  • Returns the ISO week number.

YEAR(date)

  • Returns the year.

No Input

FALSE()

  • Returns the logical value false.

NOW()

  • Returns the current date and time.

PI()

  • Returns the value of PI.

TRUE()

  • Returns the logical value true.

Any

IF(condition, value_if_true, value_if_false)

  • Returns a value based on a condition.

NULL()

  • Returns a null value.

LENGTH(value)

  • Returns the number of characters in a string.