> For the complete documentation index, see [llms.txt](https://docs.smt-x.com/smtx-online-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smt-x.com/smtx-online-documentation/fulfillment-platform/forms/calculations.md).

# Calculations

This is a brief summary of the calculation options:\
&#x20;\
&#x20; IFEMPTY (returns first arg that is not NULL or empty)

&#x20; IFZERO (returns first arg that is not 0)

&#x20; IIF (When arg1 true then return arg2, else return arg3)

&#x20; CONCAT (Concat all args)

&#x20; FORMAT (format args (arg2, arg3, ...) according to specification in arg1)

&#x20; TONUMBER (convert arg1 to a decimal. If arg1 is invalid and arg2 is given than return arg2)

&#x20; ROUND  (round decimal in arg1 to integer, or to a decimal with arg2 decimals if arg2 is provided. Arg3 is optional and can contain "floor" or "ceiling" as rounding types, but ONLY works if arg2=0.

&#x20; REPLACE (search in arg1 for arg2, and replace all occurrences to arg3. It works with a string as well.replace

&#x20; example: REPLACE('#REPLACE-FORMFIELD-Granular Access : form 1||textfield1||#', ' ', '%20')

&#x20;

&#x20; SUBSTRING  (Display in the substring arg1 from position (0-based) in arg2 for the length of arg3 (or until the end of the string if arg3 is empty )

&#x20; INDEXOF (Geeft positie (0-based) terug in arg1 van arg2

&#x20; TODATE (convert arg1 to a date, according to user culture, if arg2 is given, use that format, if arg3 is given, that is the default return value by default

&#x20; DATEDIFF (show difference between arg1 (earliest) and arg2 (last) specified in unit in arg3 (D,H,m,s)

&#x20; DATEADD (add arg2 units to date in arg1. Arg3 = unit: Y, M, D, h, m, s.Use Format to return in a string)

&#x20; NOW (returns current datetime as a datetime variable. Use Format to return in a string)

&#x20; IsDayLightSavingActive (Returns Boolean containing True if daylight saving is active in the current server timezone. Arg1 is a datetime to check on, so you can also use NOW() as arg1)

&#x20; GetUtcOffset (Returns number containing difference in hours between local server timezone and UTC time for datetime in Arg1. Eg for Brussels, the result will be 2 for a datetime in May, and 1 for a datetime in December)

&#x20; WebserviceLookup (arg1 is the webservice name, arg2 is the field you want to retrieve (use empty string when fetching scalar), arg(n)-arg(n+1) are the filter fields)

&#x20; HtmlEncode (HTML Encodes the string in arg1)

&#x20;

More up-to-date information can be found on the Wiki: <http://wiki3.smt-x.com/index.php?title=FormTips>
