Search Knowledge Base by Keyword
Below are a list of most of TaskForm’s functions that can be used in formulas.
Contents
- Contextual Formulas
- Math
- Text
- Date / Time
- Logic
- Data Conversion
- Data Sources
- Lists / Sets Of Values
- Repeats / Tables
- Choices
- Data Interchange
- Location
- Process Steps
- Advanced Maths
| 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. |
| 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. |
| USEREMAIL() | User’s Email Address |
| USERFIRSTNAME() | User’s First Name |
| USERLASTNAME() | User’s Last Name |
| USEREXTERNALID() | User’s External Id |
| ORGNAME() | Organisation Name |
| GLOBALVAL(‘keyname’) Global Value |
Gets the Global Value for the specified key name (if any) |
| ORGMETA(‘key’) Organisation Meta Value |
Gets the Provider Meta Data Value for the specified key (if any). For example if your Organisation setup contains a Meta Data key of billing_id then you may access this value across the platform with ORGMETA(‘billing_id’). |
| USERMETA(‘key’) User Meta Value |
Gets the User Meta Data Value for the specified key (if any). For example if your User setup contains a Meta Data key of billing_id then you may access this value across the platform with USERMETA(‘billing_id’). |
| 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() Screen Last Updated (UTC) |
The date & time on which the current screen on the device was last updated for GMT (UTC) time zone. |
| VAL(‘dataname’) Direct Value |
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() Screen Parameter |
Simple counter that increments by 1 every time a new Form entry is created in the app. Will left pad the counter with zero’s to the specified pad width length. Concatenate counter() with user data to generate unique numbers. NOTE: Counter numbers are device-specific. |
| TASK(‘key’) Linked Task Data – APP ONLY |
Gets data value for the given key when this Screen is linked to a Task. Returns blank value if no Task is linked. The following Task keys are available: ADDITIONALINFO, COMPLETEATLAT, COMPLETEATLON, EXTERNALID, ID, ISOVERDUE, NAME, PERFORMWITHIN, COMPLETEBY, COMPLETEBYUTC, STARTTIME, STARTTIMEUTC e.g. TASK(‘NAME’) returns the linked Task’s name value. |
| + Add |
Addition operator. NOTE: Always put a space on either side of the ‘+’ |
| – Subtract |
Subtraction operator. NOTE: Always put a space on either side of the ‘-‘ |
| * Multiply |
Multiplication operator. NOTE: Always put a space on either side of the ‘*’ |
| DIV Divide |
Division operator. NOTE: Always put a space on either side of the ‘DIV’ |
| MOD Modulo |
Modulo operator. MOD is like division but returns the remainder only. NOTE: Always put a space on either side of the ‘MOD’ |
| RANDOM(length) Random Number |
Generates a random number or string. Can be called with 0 or 1 parameter RANDOM() returns a decimal number between 0 and 1.0 RANDOM(length) returns random integer of given length |
| ROUND(val, places) Round |
Rounds the given number to the specified number of fractional places |
| POW(val, power) Power |
Returns the given number to the specified power |
| TRUNC(val) Truncate |
Truncates given number value to an integer. Effectively rounds number down to zero decimal places. |
| MAX(val1, val2) Maximum |
Returns the larger of two numbers |
| MIN(val1, val2) Minimum |
Returns the smaller of two numbers |
| CEILING(val) Ceiling |
Returns the smallest integer value that is greater than or equal to the specified number. |
| FLOOR(val) Floor |
Returns the largest integer less than or equal to the specified number |
| ABS(val) Absolute |
Returns the absolute (positive) value of a number. ABS(-5) returns 5 ABS(-5.6) returns 5.6 |
| STRING-LENGTH(val) Length |
Returns the number of characters in the given value |
| SUBSTR(val, startIndex, lengthOptional) Substring |
Retrieves a substring from the given value. Substrings start at the zero-indexed start position and run to the end of the val unless an optional character length is specified. e.g. if myfield has value ‘ABCDEF’, then: SUBSTR({{myfield}}, 2) gives CDEF SUBSTR({{myfield}}, 2, 1) gives C |
| CONCAT(val1, val2, val3) Concatenate |
Joins the given values end-to-end |
| JOIN(‘separator’, val1, val2) Concatenate With Seperator |
Joins the given values end-to-end, separated by the given separator |
| SUBSTITUTE(val, old_text, new_text) Substitute |
Substitute’s new_text for old_text into the given value.
e.g. if myfield has value ‘ABC|DEF’, then: |
| LOWER(val) Lower Case |
Converts all characters in the specified val to lower case
e.g. LOWER({{myfield}}) |
| UPPER(val) Upper Case |
Converts all characters in the specified val to upper case
e.g. UPPER({{myfield}}) |
| STARTSWITH(val, startswith) Starts With |
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.
e.g. if myfield has value ‘ABCDEF’, then: |
| CONTAINS(val, contains) Contains Text |
Returns true or false result depending on if the given contains text appears anywhere within the given text value. Matching is case insensitive.
e.g. if myfield has value ‘ABCDEF’, then: |
| INDEXOF(input, value, optionalStartIndex, optionalCount) Index/Position Of Text |
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. Optional start index will begin search at given zero-based index. Optional count specifies how many characters to search within from the start index. e.g. INDEXOF(‘AAA|BBB|CCC’, ‘A’) returns 0 |
| 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 |
| RANDOMSTR(length) Random String |
Generates a random string of characters of the given length |
| GUID() GUID |
Generates a new Globally Unique Identifier https://en.wikipedia.org/wiki/Globally_unique_identifier |
| DATEADD(startdate, numberunits, unit) Add To Date |
Returns a new Date/Time that adds the specified number of units to the specified starting date value.
e.g. DATEADD({{mydatefield}}, 6, ‘MM’) Unit specifiers are: |
| DATEDIFF(startdate, enddate, unit) Difference Between Dates |
Calculates the total number of minutes, hours, days, months, or years between two date/times. e.g. DATEDIFF({{mydatefield}}, now(), ‘HH’) Unit specifiers are: If you wish to exclude weekend days from the calculation, specify the optional true/false parameter to exclude weekends as follows: where the above function would return 6 days. |
| DATETOLOCAL(utcdateval) Convert UTC Date to Local Date [BETA] |
Converts the given UTC date time value to local date time. When used in a Form Design the local time is based on the device’s local time. If used in a template, local time is based on the Organisation’s Default time zone. e.g. DATETOLOCAL({{mydatefield}} |
| DATETOUTC(localdateval) Convert Local Date to UTC Date [BETA] |
Converts the given UTC date time value to local date time. When used in a Form Design the local time is based on the device’s local time. If used in a template, local time is based on the Organisation’s Default time zone. e.g. DATETOLOCAL({{mydatefield}}) |
| YEAR(dateval) Year |
Returns the year portion of the specified date value.
e.g. YEAR({{mydatefield}}) |
| MONTH(dateval) | Returns the month portion of the specified date value.
e.g. MONTH({{mydatefield}}) |
| DAY(dateval) Day |
Returns the day portion of the specified date value.
e.g. DAY({{mydatefield}}) |
| HOUR(dateval) Hour |
Returns the hours portion of the specified date value.
e.g. HOUR({{mydatefield}}) |
| MINUTE(dateval) Minute |
Returns the minutes portion of the specified date value.
e.g. MINUTE({{mydatefield}}) |
| SECOND(dateval) Second |
Returns the seconds portion of the specified date value.
e.g. SECOND({{mydatefield}}) |
| DAYWEEK(dateval) Day of Week |
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. |
| = Equal To |
Returns true if both operands are equal |
| < Less Than |
Returns true if the first operand is less than the second |
| > Greater Than |
Returns true if the first operand is greater than the second |
| OR Divide |
Returns true if any one of the operands is true |
| AND Modulo |
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) Conditional (if/else) |
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.
e.g. IF({{score}} > 50, ‘YOU PASS’, ‘YOU FAIL’) |
| ISBLANK(val) Is Blank or Empty |
Returns true/false based on whether the given value is blank/empty. An easy way to check if a field has no answer |
| NOTBLANK(val) NOT Blank or Empty |
Returns true/false based on whether the given value is not blank/empty. An easy way to check if a field has any answer. |
| COALESCE(val1, val2) First Non-Empty Value (coalesce) |
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) Regular Expression Match |
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. https://msdn.microsoft.com/en-us/library/hs600312(v=vs.110).aspx |
| REPLACE(input, pattern, replacement) Regular Expression 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.
|
