Skip to Content

Formula Reference

This is the reference for Momen formulas. More built-in formulas are added over time.

Type conversion

NameDescriptionExample
TO_TEXTConverts integers, decimals, boolean, or JSON to textOriginal data: {"message": "Hello World!"} → '{"message": "Hello World!"}'
TEXT_TO_INTEGERConverts text to integersOriginal data: "-3.1415926" → -3
TO_DECIMALConverts text to decimalsOriginal data: "-3.1415926" → -3.1415926
TEXT_TO_DATETIMEConverts text to datetimeOriginal data: "2025-02-21 14:36" → 2025-02-21T14:36:00.000+08:00
COMBINE_DATE_AND_TIMECombines date and time into datetimeDate: 2024-01-08, Time: 13:38:00.000+08:00 → 2024-01-08T13:38:00.000+08:00
EXTRACT_DATE_OR_TIMEExtracts date or time from datetime (timestamp)Datetime: 2024-01-08 13:38:00.000+08:00, Extract: Date → 2024-01-08

Text

NameDescriptionExample
TEXT_LENReturns the length of the text. All characters (including Chinese, letters, numbers, symbols) count as one.Text: "Hello World!" → 12
REPLACE_PARTReplaces part of the text with new text based on the specified position (first character is 0) and number of characters.Text: "Hello World!", Start: 1, Length: 4, New text: "ola" → "Hola World!"
REPLACE_TEXTFinds the specified text and replaces it with new text, based on the number of occurrences.Text: "Hello World!", Old: "o", New: "", Count: 1 → "Hell World"
FINDReturns the position of the first occurrence of the specified text. Returns -1 if not found.Text: "Hello World!", Find: "o" → 4
CONTAINSChecks if the specified text exists, returns true or false.Text: "Hello World!", Find: "ello" → true
SUB_TEXTExtracts a substring. Includes the start position but not the end; first character is 0.Text: "Hello World!", Start: 0, End: 5 → "Hello"
LEFTReturns a specified number of characters from the start of the text.Text: "Hello World!", Count: 5 → "Hello"
RIGHTReturns a specified number of characters from the end of the text.Text: "Hello World!", Count: 5 → "World"
LOWERConverts all letters in the text to lowercase.Text: "Hello World!" → "hello world!"
UPPERConverts all letters in the text to uppercase.Text: "Hello World!" → "HELLO WORLD!"
RANDOM_TEXTGenerates random text. (Random characters are generated on the frontend and are not recommended for secure scenarios such as coupon codes.)Min length: 5, Max length: 10, Lowercase: true, Uppercase: true, Numbers: true → "seXr3aoRD"
SPLITSplits the text into an array using the specified separator.Text: "2024/01/08", Separator: "/" → ["2024", "01", "08"]
ENCODE_URLConverts text string to URL standard formatText: "https://docs.momen.app/data/formula/" → "https%3A%2F%2Fdocs.momen.app%2Fdata%2Fformula%2F"
DECODE_URLDecodes a URL encoded by ENCODE_URL functionText: "https%3A%2F%2Fdocs.momen.app%2Fdata%2Fformula%2F" → "https://docs.momen.app/data/formula/"
UUIDRandomly generates a string-type unique identifierNone → "550e8400-e29b-41d4-a716-446655440000"
TEXT_REPEATRepeats text a specified number of timesText: "Yes", Count: 3 → "YesYesYes"
TRIMRemoves spaces from the beginning and end of textText: " dadada " → "dadada"
REGEX_EXTRACTExtracts the first text segment that matches the regexText: "Phone number is 13940983244", Regex: \d{11} → "13940983244"
REGEX_EXTRACT_ALLReturns all text segments that match the regexText: "Phone: 13940983244 and 13234322452", Regex: \d{11} → ["13940983244","13234322452"]
REGEX_MATCHDetermines if text contains content that matches the regexText: "13812345678", Regex: ^\d{11}$ → true
REGEX_REPLACEReplaces parts of text that match the regexSource text: "Phone number is 13812345678", Regex: \d{11}, Replace: "***********" → "Phone number is ***********"
TEXT_CONCATConcatenates multiple text values into one text.Text 1: "Hello", Text 2: "World!" → "HelloWorld!"

Math

NameDescriptionExample
+Addition5 + 10 → 15
-Subtraction5 - 10 → -5
*Multiplication5 * 10 → 50
/Division5 / 10 → 0.5
%Remainder after division, same sign as dividend-5 % 10 → -5
MINReturns the minimum value5, 10 → 5
MAXReturns the maximum value5, 10 → 10
ROUND_UPRounds up to the nearest integer3.5 → 4
ROUND_DOWNRounds down to the nearest integer-3.5 → -4
INTRounds to the nearest integer-3.5 → -3
ABSReturns the absolute value-3.5 → 3.5
RANDOM_NUMBERReturns a random integer within the specified closed interval, i.e. both the min and the max can be returned (not recommended for secure scenarios)Min: 1, Max: 10 → 6
POWERExponentiationBase: 2, Exponent: 3 → 8
FORMAT_DECIMALDecimal formatting (returns text if “Remove all trailing zeros” is selected)3.1415926, Precision: 2, Remove trailing: true → 3.14
LOGReturns the logarithm of a number with specified baseNumber: 8, Base: 2 → 3
FORMAT_NUMBERFormats a number. Can be used for percentage, thousand separators, etc.Number: 1, Format type: "percent", Decimal places: 2 → "100.00%"

Arrays

NameDescriptionExample
GET_ITEMRetrieves an item from an array (index starts from 0)["2024", "01", "08"], Index: 1 → "01"
ARRAY_LENGTHGets the length of the array["2024", "01", "08"] → 3
FIRST_ITEMReturns the first item of the array["2024", "01", "08"] → "2024"
LAST_ITEMReturns the last item of the array["2024", "01", "08"] → "08"
RANDOM_ITEMReturns a random item from the array["2024", "01", "08"] → "01"
SLICEExtracts a section of the array["2024", "01", "08"], Start: 1, Count: 2 → ["01", "08"]
JOINJoins an array of text into a string["2024", "01", "08"], Separator: "-" → "2024-01-08"
INDEX_OFReturns the index of the first occurrence of the specified item["2024", "01", "08"], Item: "08" → 2
SEQUENCEGenerates a number sequence within the specified range (inclusive of start, exclusive of end).Start: 0, End: 10, Step: 2 → [0,2,4,6,8]
COALESCEReturns the first “non-null” item in the array from left to rightArray: [null,1,3,2] → 1
ARRAY_MAXReturns the maximum item value in the arrayArray: [1,2,3] → 3
ARRAY_MINReturns the minimum item value in the arrayArray: [1,2,3] → 1
ARRAY_SUMSums the values of items in the arrayArray: [1,2,3] → 6
ARRAY_AVERAGEReturns the average value of items in the arrayArray: [1,2,3] → 2
ARRAY_CONCATMerges two arrays into one arrayArray1: [1,2,3,4,5], Array2: [2,3,4] → [1,2,3,4,5,2,3,4]
UNIQUERemoves duplicate items from the arrayArray: [1,2,5,4,5,2,3,4] → [1,2,5,4,3]
ARRAY_MAPPINGTransforms each element of an array and returns a new arrayOriginal array: [1,2,3,4], New array item: Original array item * 10 → [10,20,30,40]
FILTERFilters the array based on a condition and returns a new arrayOriginal array: [1,2,3,4], Condition: Original array item > 2 → [3,4]

Enums

NameDescriptionExample
ENTRIESConverts enum type to an array.Enum: TaskStatus (with values: NOT_STARTED, INPROGRESS, COMPLETED) → [{"name": "NOT_STARTED"}, {"name": "INPROGRESS"}, {"name": "COMPLETED"}]

Date and time

NameDescriptionExample
GET_DATE_TIMEGets a point in timeYear: 2024, Month: 1, Day: 8, Hour: 13, Minute: 14, Second: 0 → 2024-01-08T13:14:00.000+08:00
DELTAAdds or subtracts timeTime: 13:38:00.000+08:00, Add 1 hour 12 min → 14:50:00.000+08:00
DURATIONCalculates the interval between two points in timeStart: 2019-12-01, End: 2024-01-08, Unit: Year → 5
EXTRACTRetrieves a specified part of the time. For day of week, outputs integers 0-6, where 0 represents SundayTime: 13:38:00.000+08:00, Unit: Hour → 13
TO_DATETIMEConverts date and time into DateTime (timestamp)Date: 2024-01-08, Time: 13:38:00.000+08:00 → 2024-01-08T13:38:00.000+08:00
TO_DATE_TIMERetrieves the date or time from a DateTime (timestamp)DateTime: 2024-01-08 13:38:00.000+08:00, Extract: Date → 2024-01-08
FORMAT_DATE_TIMEFormats a datetime with standard format placeholders. For formatting rules, please refer to Time Formatting Datetime: 2025-12-19T14:00:00.000+08:00, Format: "MMM. Do, YYYY", Language: "en" → "Dec 19th, 2025"
TIME_AGORelative time formatting (returns relative time description from now).Datetime: 2025-12-18T14:00:00.000+08:00, Language: "en", Hide suffix: true → "5 hours ago"
FORMAT_DURATIONFormats a given duration value into a readable text.Duration: 1000000, Unit: "Milliseconds", Format: "m min s sec" → "16 min 40 sec"

Location

NameDescriptionExample
DISTANCECalculates the distance between two locations (meters, kilometers, or miles)[120.2934,30.3150], [120.2934,31.3150], km → 866
GET_VALUE_FROM_GEO_POINTRetrieves longitude or latitude from a geo point (latitude and longitude)[120.2934,30.3150], Type: Latitude → 30.3150
GENERATE_GEO_POINTCreates a standard geographical location coordinate point (GeoJSON format).Longitude: 120.1, Latitude: 30.3150 → {"type":"Point","coordinates":[120.1,30.3150]}

JSON

NameDescriptionExample
JSON_EXTRACT_PATHRetrieves data from JSON{"data": {"foo": "bar"}}, Path: data.foo → "bar"
Last updated on