Below is a comprehensive list of Forms On Fire formula functions that can be used in various field properties throughout the platform wherever the hammer icon is present.
1. CONTEXTUAL FORMULAS
TODAY() | The current local date reported by the device. |
NOW() | The current local date and time reported by the device. NOTE: Now() will not return a time value unless used in conjunction with FORMAT-DATE. Please see section 6 b for more information. |
UTCTODAY() | The current Greenwich Mean Time (GMT) date reported by the device. |
UTCNOW() | The current Greenwich Mean Time (GMT) date and time reported by the device. NOTE: Now() will not return a time value unless used in conjunction with FORMAT-DATE. Please see section 6 below for more information. |
USEREMAIL() | User's Email Address |
USERFIRSTNAME() | User's First Name |
USERLASTNAME() | User's Last Name |
USEREXTERNALID() | User's External Id |
ORGNAME() | Organization Name |
GLOBALVAL('keyname') | Gets the Global Value for the specified key name (if any) |
ORGMETA('key') | Gets the Provider Meta Data Value for the specified key (if any). |
USERMETA('key') | Gets the User Meta Data Value for the specified key (if any). |
DEVICENAME() | The device name. |
DEVICEOS() | The device operating system. |
DEVICEOSVERSION() | The device operating system version. |
APPVERSION() | The current version of the app installed on the user's device. |
SCREENVERSION() | The version number of the current screen on the device. |
SCREENDATE() | The date & time on which the current screen on the device was last updated for GMT (UTC) time zone. |
VAL('dataname') | Returns the current answer value of the given field. Useful for avoiding circular reference issues - e.g.,, when filtering repeated values in a Choices field based on its own current value. |
COUNTER() | Simple counter that increments by 1 every time a new Form entry is created in the app. Will left pad the counter with zeros to the specified pad width length, specified by an integer inside the parentheses -- e.g., counter(5) will add enough zeroes to make the number 5 digits in length. Concatenate counter() with user data to generate unique numbers. |
TASK('key') | Gets data value for the given key when this Screen is linked to a Task. Returns blank value if no Task is linked. |
USERLANG() | Returns the currently set user language in the app in settings. e.g. IF(USERLANG()= 'English', true, false) Used in this format you can control visibility to certain fields in your app, so if a user is English-speaking (for example), then this visibility formula could be used to hide the French fields from them and only show the English fields. |
2. MATH
+ | Addition operator. |
- | Subtraction operator. |
* | Multiplication operator. |
DIV | Division operator. |
MOD | Modulo operator. MOD is like division but returns the remainder only. |
RANDOM(length) | Generates a random number or string. Can be called with 0 or 1 parameter |
ROUND(val, places) | Rounds the given number to the specified number of fractional places |
POW(val, power) | Returns the given number to the specified power |
TRUNC(val) | Truncates given number value to an integer. |
MAX(val1, val2) | Returns the larger of two numbers |
MIN(val1, val2) | Returns the smaller of two numbers |
CEILING(val) | Returns the smallest integer value that is greater than or equal to the specified number. |
FLOOR(val) | Returns the largest integer less than or equal to the specified number |
ABS(val) | Returns the absolute (positive) value of a number. |
3. TEXT
STRING-LENGTH(val) | Returns the number of characters in the given value |
SUBSTR(val, startIndex, lengthOptional) | Retrieves a substring from the given value. |
CONCAT(val1, val2, val3) | Joins the given values end-to-end |
JOIN('separator', val1, val2) | Joins the given values end-to-end, separated by the given separator |
SUBSTITUTE(val, old_text, new_text) | Substitute’s new_text for old_text into the given value. |
LOWER(val) | Converts all characters in the specified val to lower case |
UPPER(val) | Converts all characters in the specified val to upper case |
STARTSWITH(val, startswith) | Returns true or false result depending on if the given starts with text appears at the beginning of the given text value. Matching is case insensitive. |
CONTAINS(val, contains) | Returns true or false result depending on if the given contains text appears anywhere within the given text value. Matching is case insensitive. |
INDEXOF(input, value, optionalStartIndex, optionalCount) | Gets the zero-based position for the first occurrence of the given value in the input text. Returns -1 if the search value is not found. |
SPLIT(input, delimiter, optionalIndex) Split String | Splits text input into a List of values based on the specified delimiter character. This resulting List can be used within aggregate functions such as SUM() or COUNT(). If optional zero-based index is specified, then returns the single value at the given index or BLANK if the index is not within the list. e.g. SPLIT({{nfcField}}, ',', 2) returns the 3rd element in the comma seperated list e.g. SPLIT('AAA|BBB|CCC', '|', 0) is AAA e.g. SPLIT('AAA,BBB,CCC', ',') is a list with AAA, BBB and CCC as it's elements e.g. MAX(SPLIT('1-2-5-4-3', '-')) is 5 e.g. SPLIT('AAA,BBB,CCC', ',' , 99) is BLANK as there is not 100 elements in the input list |
RANDOMSTR(length) | Generates a random string of characters of the given length |
GUID() | Generates a new Globally Unique Identifier |
'\n' New line character | While this is not an actual function(), you can use the '\n' character in any string or body of text to tell our platform to output text on a new line. E.g. if myfield has value 'ABC|DEF', then: SUBSTITUTE({{myfield}}, '|', '\n') replaces | with new line. When saving this text to a data source, make sure that the column data type where this is set to "Multiline Text". |
4. DATE / TIME
DATEADD(startdate, numberunits, unit) | Returns a new Date/Time that adds the specified number of units to the specified starting date value. |
DATEDIFF(startdate, enddate, unit) | e.g., DATEDIFF({{mydatefield}}, now(), 'HH') |
DATETOLOCAL(utcdateval) | Converts the given UTC date time value to local date time. |
DATETOUTC(localdateval) | Converts the given UTC date time value to local date time. |
YEAR(dateval) | Returns the year portion of the specified date value. |
MONTH(dateval) | Returns the month portion of the specified date value. |
DAY(dateval) | Returns the day portion of the specified date value. |
HOUR(dateval) | Returns the hours portion of the specified date value. |
MINUTE(dateval) | Returns the minutes portion of the specified date value. |
SECOND(dateval) | Returns the seconds portion of the specified date value. |
DAYWEEK(dateval) | Returns the numbered day of the year for the specified date value. |
DAYYEAR(dateval) Day of Year | Returns the numbered day of the year for the specified date value. Values returned are between 1 and 366. e.g. DAYYEAR({{mydatefield}}) |
WEEKYEAR(dateval) Week of Year | Returns the numbered week of the year for the specified date value. Values returned are between 1 and 52. e.g. WEEKYEAR({{mydatefield}}) |
IMGDATE(imagefield) Creation Date/Time of Image | Returns the original creation date and time of the given image field's file, as found in the file's EXIF metadata. If this metadata is not available, the date and time of capture into the image field is returned. The date/time returned is in the local timezone of the device. |
5. LOGIC
= | Returns true if both operands are equal |
< | Returns true if the first operand is less than the second |
> | Returns true if the first operand is greater than the second |
OR | Returns true if any one of the operands is true |
AND | Returns true if both of the operands is true |
NOT(val) | Returns true if the value given is false, and false if the value given is true |
TRUE() | Returns true |
FALSE() | Returns false |
IF(condition, trueval, falseval) | Let's you return one of two values based on whether the given condition is true or false. Useful for toggling a field's dynamic value based on previous answers. |
ISBLANK(val) | Returns true/false based on whether the given value is blank/empty. |
NOTBLANK(val) | Returns true/false based on whether the given value is not blank/empty. |
COALESCE(val1, val2) | Use this function when you want to guarantee a non-blank value is returned. This is useful when doing scoring calculations - wrap each answer in a COALESCE({{answer}}, 0) to ensure you get a zero if the user has not provided an answer. |
REGEX(input, pattern) | Returns true/false based on whether the regular expression finds a match in the input string. Regular expressions are a very powerful, advanced feature. Learn about regular expressions. .NET Regular Expressions - .NET| Microsoft Learn Regular Expression Language - Quick Reference - .NET | Microsoft Learn |
REPLACE(input, pattern, replacement) | Replaces the text matched by the given regular expression with the text specified in the replacement string. Note that the regular expression pattern can be static text or passed in from another field. |
6. DATA CONVERSION
FORMAT-DATE(val, format) | Convert a date/time to formatted string value. Note that this is not an exhaustive list of formatting options. Please refer to this article for more. |
FORMAT-GEO(val, format) | Converts a geo location to formatted text value. |
OR | Returns true if any one of the operands is true |
AND | Returns true if both of the operands is true |
NOT(val) | Returns true if the value given is false, and false if the value given is true. |
TRUE() | Returns true |
FALSE() | Returns false |
FORMAT-NUM(val, format, optionalCulture) | Convert a number to a formatted string value. Consider also for formatting a number into USD currency: CONCAT('$',FORMAT-NUM({{sampleField}}, '#,###.##', en-US)) |
DATE(val, 'optionalFormat') | Converts the given value to a date value, optionally using the specified format. |
STRING(val)DATE(val) | Converts the given value to a string value |
INT(val) | Converts the given value to an integer value |
NUMBER(val) | Converts the given value to a numerical value |
BOOLEAN(val) | Converts the given value to a boolean value |
CBOX(val, matchTo) | Returns a Unicode checkbox that is ticked or crossed, depending on whether val equals matchTo. |
CBOXB(val, matchTo) | Returns a Unicode checkbox that is ticked or blank, depending on whether val equals matchTo. |
IMGURL(imgfieldname) | Generates the web URL to the given image field. |
FILEURL(fieldname) To File URL | Generates the web URL to the given file field (e.g. Media or Attachment field types). Useful for assignment into a Data Source image column or for providing direct download links in Connector outputs. |
7. DATA SOURCES
DSCOUNT(dsId, 'optionalFilterFormula') | Counts rows in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page) |
DSSUM(dsId, columnIndex, 'optionalFilterFormula') | Sums column values in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page). |
DSAVG(dsId, columnIndex, 'optionalFilterFormula') | Averages column values in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by its External Id (from the Data Source -> Settings page). Refer to the column by its zero-based index. |
DSMAX(dsId, columnIndex, 'optionalFilterFormula') | Gets maximum column value in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page). Refer to the column by it's zero-based index. |
DSMIN(dsId, columnIndex, 'optionalFilterFormula') | Gets minimum column value in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page). Refer to the column by it's zero-based index. |
DSFIRST(dsId, columnIndex, 'optionalFilterFormula') | Gets first column value in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page). Refer to the column by it's zero-based index. |
DSLAST(dsId, columnIndex, 'optionalFilterFormula') | Gets last column value in the given Data Source, optionally filtering rows by formula. Refer to the Data Source by it's External Id (from the Data Source -> Settings page). Refer to the column by it's zero-based index. |
8. LISTS / SETS OF VALUES
LIST(pattern, 'optionalFilterFormula') | Collects answers from fields with data names matching the given regular expression pattern. List results are typically used with functions like SUM()/COUNT() to calculate results on fields that follow a common naming convention - e.g., survey fields like q1, q2, q3 etc. |
TOLIST(value, 'optionaldelimiter', 'optionalFilterFormula') | Converts the given value to a List. The value must be text containing delimited List elements - e.g., 34|76|9 Second optional parameter is the delimiter character separating elements. Default is pipe character. |
TOLIST({{myfield1}}, {{myfield2}}, ..., {{myfieldN}}, 'optionalFilterFormula') Convert To List (Multi-field) Convert To List (Multi-field) | Converts the given fields to a List where each field value is an element in the list. Second optional parameter applies a filter formula to the List elements gathered, leaving only elements that pass the condition. Use {{this}} to refer to the element value in formula. e.g. TOLIST({{myfield1}}, {{myfield2}}, ..., {{myfield3}}) e.g. TOLIST({{myfield1}}, {{myfield2}}, ..., {{myfield3}},'STARTSWITH({{this}}, "B")') |
IN(value, list) | Returns true if the given value is found within the given List. |
NOTIN(value, list) | Returns true if the given value is NOT found within the given List. |
COUNT(list) | Counts the values in the given List. Parameter must be a valid List function such as LIST() or PRIOR() |
SUM(list) | Sums the values in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
AVERAGE(list) | Averages the values in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
MIN(list) | Gets minimum value in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
MAX(list) | Gets the maximum value in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
FIRST(list) | Gets the first value in the given List. Parameter must be a valid List function such as LIST() or PRIOR() |
LAST(list) | Gets the last value in the given List. Parameter must be a valid List function such as LIST() or PRIOR() |
9. REPEATS / TABLES
POSITION({{repeat}}) | The page/row number of the current repeat Page or Table row. |
PRIOR('dataname', occurrences) | Gets the previous repeat/row value(s) of the named field within a Page/Table, starting from the current repeat context. Should only be used within a repeatable Page or Table. Optional second parameter specifies how many prior answers to retrieve. Prior repeat values are returned as a List unless the second parameter is 1; if so the value of the last prior answer is returned. Useful for performing aggregate functions on repeat values thus far (e.g., SUM,COUNT) and, if second parameter is 1, for copying forward the previous repeat/row value into the current new instance. |
COUNT({{repeat}}) | Counts the repeats/rows of a Page/Table. |
SUM({{numfield}}) | Sums a Number field across all repeats/rows of a Page/Table. |
AVERAGE({{numfield}}) | Averages a Number field across all repeats/rows of a Page/Table. |
SUM(list) | Sums the values in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
AVERAGE(list) | Averages the values in the given numeric List. Parameter must be a valid List function such as LIST() or PRIOR() |
MAX({{numfield}}) | Maximum value of a Number field across all repeats/rows of a Page/Table. |
MIN({{numfield}}) | Minimum value of a Number field across all repeats/rows of a Page/Table. |
FIRST({{repeatfield}}) | Value of the first occurrence/row of a repeatable Page or Table field. |
LAST({{repeatfield}}) | Value of the last occurrence/row of a repeatable Page or Table field. |
10. CHOICES
SELECTED({{choicesfield}}, 'val') | Returns true if the value given is selected in the given choices field, false otherwise. |
COUNT-SELECTED({{choicesfield}}) | Returns the number of choices selected on the given choices field. |
11. LOCATION
LAT(locationval) | Returns the latitude in decimal degrees of the given location value. |
LON(locationval) | Returns the longitude in decimal degrees of the given location value. |
HEADING(locationval) | Returns the heading against true north in decimal degrees of the given location value. |
ALTITUDE(locationval) | Returns the altitude above/below sea level in metres of the given location value. |
ACCURACY(locationval) | Returns the accuracy in metres of the given location value. |
STREETNUM(locationval) | Returns the street number for the given location value. |
STREET(locationval) | Returns the street name for the given location value. |
CITY(locationval) | Returns the city / locality name for the given location value. |
COUNTY(locationval) | Returns the county / district area for the given location value. Mainly USA specific. |
STATE(locationval) | Returns the state / province for the given location value. |
POSTCODE(locationval) | Returns the postal / zip code of the given location value. |
COUNTRY(locationval) | Returns the ISO country code of the given location value. |
MIBETWEEN(startPoint, endPoint) | Finds the miles between two geo-points, using great-circle math. |
KMBETWEEN(startPoint, endPoint) | Finds the kilometres between two geo-points, using great-circle math. |
INPOLYGON(point, polygonPoints) | Returns a true/false answer on whether the given geo-point is within the given polygon. |
12. PROCESS STEPS
STEP-CURRENT() | Returns the name of the current Step in the process. If no Step has occurred yet, then this function returns a blank value. |
STEP-ISCURRENT('dataname') | Returns true if the named Process Step field is the current Step in the process. If no Step has occurred yet, this function returns true for ANY Process Step name. |
STEP-COMPLETED() Last Completed Step [BETA] | Returns the name of the Step most recently completed in the process. If no Step has been completed as yet (e.g. in a brand new Form entry in progress on the app), then this function returns a blank value. This function is ideal for use in Connectors because it will always return a value (since a Step is completed as soon as the entry is uploaded). |
STEP-RESULT('dataname') | Returns the result of the named Process Step field, if any is set |
STEP-EMAIL('dataname') | Returns the email of the user that decided the result (if any) of the named Process Step field |
STEP-FIRST('dataname') | Returns the first name of the user that decided the result (if any) of the named Process Step field |
STEP-LAST('dataname') | Returns the last name of the user that decided the result (if any) of the named Process Step field |
13. ADVANCED MATH
PI() | Returns the number 3.14159265358979, the mathematical constant Pi, accurate to 15 digits. |
DEGREES(angle) | Converts radians to degrees |
RADIANS(angle) | Converts degrees to radians |
SQRT(val) | Returns a number which, when multiplied by it self, will produce the given value. |
LOG(val, base) | Returns the exponent to which the given base must be raised to produce the given value. |
SIN(val) | Returns sine of given radian angle value. |
COS(val) | Returns cosine of given radian angle value. |
TAN(val) | Returns tangent of given radian angle value. |
ASIN(val) | Returns the arcsine, or inverse sine, of a number. |
ACOS(val) | Returns the arccosine, or inverse cosine, of a number. |
ATAN(val) | Returns the arctangent, or inverse tangent, of a number. |
SINH(val) | Returns hyperbolic sine of given radian angle value. |
COSH(val) | Returns hyperbolic cosine of given radian angle value. |
TANH(val) | Returns hyperbolic tangent of given radian angle value. |
14. SYSTEM VALUES
TODAY() Current Date | The current local date reported by the device. NOTE: Device dates can be inaccurate if the local time is not correct. |
NOW() Current Date and Time | The current local date and time reported by the device. NOTE: Device times can be inaccurate if the local time is not correct. NOTE: Now() will not return a time value unless used in conjunction with FORMAT-DATE. Please see section 6 above for more information. |
UTCTODAY() Current UTC (GMT) Date | The current Greenwich Mean Time (GMT) date reported by the device. |
UTCNOW() Current UTC (GMT) Date & Time | The current Greenwich Mean Time (GMT) date and time reported by the device. |
TASK-FIRSTAVAILABLE() | Returns the 'First Available' automatic user assignment identifier. Also handy to use as a Process Step field's 'Send Form To' value. The optional parameter allows you to restrict the Task assignment to only users within the given User Group name or external ID. Examples of use: TASK-FIRSTAVAILABLE() will assign randomly to first of all available users TASK-FIRSTAVAILABLE('mygroup') will assign randomly to first available user in User Group named 'mygroup' TASK-FIRSTAVAILABLE({{myfield}}) will assign randomly to first available user in User Group name/ID matching the answer of field with name 'myfield' |
TASK-FIRSTTOCLAIM() | Returns the 'First To Claim' user assignment identifier. Useful for creating new Tasks to be performed by the first user to claim. Also handy to use as a Process Step field's 'Send Form To' value. The optional parameter allows you to restrict the Task visibility to only users within the given User Group name or external ID. Examples of use: TASK-FIRSTTOCLAIM() Task will be visible to all users TASK-FIRSTTOCLAIM('mygroup') will be visible to users in User Group named 'mygroup' TASK-FIRSTTOCLAIM({{myfield}}) will be visible to users in User Group name/ID matching the answer value of field with name 'myfield'
|
15. DATA INTERCHANGE
HTTPSTATUS({{restField}}) | Returns the HTTP status code received when the given REST field last performed a REST request. e.g., If the REST field named 'myRestField' executes a request successfully then HTTPSTATUS({{myRestField}}) should return a value of '200'. |
JSONVAL({{myjson}}, 'resp.token') Value From JSON | Returns the value from the given JSON for the given JSONPath query. Use the optional true/false validate parameter to raise an error if the query fails. Note: The JSONPath '$.' prefix is not required. e.g., JSONVAL({{myjson}}, 'resp.token') |
JSONLIST({{myjson}}, 'resp.products.id') List of Values From JSON | Returns a List of values from the given JSON for the given JSONPath query. Use the optional true/false validate parameter to raise an error if the query fails. Note: The JSONPath '$.' prefix is not required. Learn more about JSONPath |
XMLVAL({{myxmlfield}}, 'resp/token') Value From XML | Returns the value from the given XML for the given XPath query. Use the optional true/false validate parameter to raise an error if the query fails. Note: The opening XPath '/' is not required. e.g., XMLVAL({{myxmlfield}}, 'resp/token') |
XMLLIST({{myxml}}, 'resp/products/id') List of Values From XML
| Returns a List of values from the given XML for the given XPath query. Note: The opening XPath '/' is not required. e.g., XMLVAL({{myxmlfield}}, 'resp/token')
|