HomeGuidesRecipesAPI
HomeGuidesAPILog In

Formatting and Data Functions

Functions
Base64EncodeString()FileDownloadLink()JsonEncode()
Base64DecodeString()FileImageDisplay()Left(), Right() and Substring()
Chr()FileUrl()Length()
Concat()Format()ProperCase()
Count()FindIndex()RegexMatch()
CountIf()HtmlEncode()RangeIndex()
CountNumber()IndexOf()Replace()
First()LastIndexOf()StartsWith() and EndsWith()
Last()ItemAt()UrlEncode()
DocumentViewer()Join()Switch()
Errormask()JoinAnd()

Function Base64EncodeString()

Encodes the supplied string value as Base64.

Syntax
Base64EncodeString(s)

ParameterDescription
sThe string value to be encoded into a Base64 representation.

Function Base64DecodeString()

Decodes the supplied Base64 string value into its original value.

Syntax
Base64DecodeString(s)

ParameterDescription
sThe Base64 representation of the string to be decoded to its original value.

Function Chr()

This function allows characters to be referenced by their ASCII decimal code. This is useful for when characters, such as the copyright symbol ‘©’, are not readily available on the keyboard.

Syntax
chr( v )

ParametersDescription
vThe ASCII decimal code of the required character or symbol.

Function Concat()

Returns a string created by concatenating of any number of strings or question references.

Syntax
Concat( p[1], p[2], .., p[n] )

ParameterDescription
p[n]An expression or value to be concatenated, which may include equations, question references and function calls.

Function Count()

Returns the total number of rows in a repeating page or section, or in a multi row data source.

This is an aggregate function

Syntax

Count( r )

ParametersDescription
rReference to a question in a repeating page, repeating section or multiple row data source.

Function CountIf()

CountIf() returns the number of values retrieved from a repeating section, page or data source that match a specified value.

This is an aggregate function

Syntax

CountIf( f, s )

ParametersDescription
fReference to a question within a repeating page, repeating section or multiple row data source.
sThe value to search for.

Function CountNumber()

Returns the number of numerical values in a set of mixed data types. Any non-numerical values are ignored in the count.

This is an aggregate function

Syntax
CountNumber( r )

ParametersDescription
rReference to a question in a repeating page, repeating section or multiple row data source.

Function First() and Last()

Returns the first or last value in a set.

This is an aggregate function

Syntax
First( r )

Last( r )

ParameterDescription
rThis is a reference to a question in a repeating page, repeating section or multiple row data source

Function DocumentViewer()

Returns a link (HTML Anchor Tag) for viewing binary files as a pop-out modal, retrieved from a data connection.

Syntax

DocumentViewer(r, f, t)

ParametersDescription
rReference to a Data Connection Answer (Field) pointing to the binary data
tFilename/extension of the binary data
fLink Text

Function Errormask()

Evaluates an expression and returns a constant number or string if the expression returns an error.

Syntax

ErrorMask (e,v)

ParametersDescription
eAny valid formula expression, including functions, equations and question references.
vA numeric or string value to be returned if an error is generated by evaluating the first parameter.

📘

Notes

A string value can also be returned if an expression returns an error. Eg: ErrorMask([q1]+[q2]+[q3], “Non-numeric values can’t be added”) 1.The first parameter in an ErrorMask function should always be an expression. Eg: ErrorMask([q3], 0) – Wrong ErrorMask([q3]/1, 0) – Correct

Function FileDownloadLink()

Returns a link (HTML Anchor Tag) for downloading binary files retrieved from a data connection.

Syntax

FileDownloadLink(r, f, t)

ParametersDescription
rReference to a Data Connection Answer (Field) pointing to the binary data
tFilename/extension of the binary data
fLink Text

Function FileImageDisplay()

Returns an image (HTML Image Tag) that will render a binary image file retrieved from a data connection for display within an in progress form or dashboard.

Syntax

FileImageDisplay(r, f, d [, h] [, w])

ParametersDescription
rReference to a Data Connection Answer (Field) pointing to the binary image data.
fFilename/extension of the binary data (.jpg, .jpeg, .png, etc.) files.
dDescription of the image. Appears as hover text and is useful for screen-reading tools.
h(Optional) The maximum height of the image in pixels.
w(Optional) The maximum width of the image in pixels.

Function FileUrl()

Returns a link that can be used to render a custom HTML tag within a form.

📘

Note

The file is only available during the user’s current session.

Syntax

FileUrl(r, f)

ParametersDescription
rReference to a Data Connection Answer (Field) pointing to the binary data.
fFilename/extension of the binary data

Function Format()

Returns a string created by formatting a value in the specified style.

Syntax

Format( e, f )

Format( e, f, c)

ParameterDescription
eAn expression or value to be formatted, which may include equations, question references and function calls
fThe format string to apply to the expression.
cCulture to apply to the form, regardless of end user settings. Refer to the Culture code here.

Function FindIndex()

Finds the first occurence of an item in a pipe-separated array, and returns its one based index position. Returns blank if the item is not found.

Syntax
FindIndex(item,array)

Partial matches are not considered.

Function HtmlEncode()

Converts a specified string and applies HTML encoding so it is safe to use in HTML.

Syntax

HtmlEncode(s)

ParameterDescription
sThe string to encode

The browser will display this as bold instead of bold.

Function IndexOf() and LastIndexOf()

IndexOf and LastIndexOf functions search for a pattern in a string and return its zero based position. The difference is IndexOf returns the first zero based position while LastIndexOf returns the last zero based position. If the pattern is not found, -1 will be returned.

Syntax

IndexOf(s, p)
LastIndexOf(s, p)

ParametersDescription
sThe string to search into
pThe pattern to find in the string

Function ItemAt()

Takes an index and a pipe-separated array, and returns the item at the specified index. This function can be used to return data from any form of listed items within the form.

Syntax
ItemAt(index,array)

Indexed at one (i.e. the first item is index 1).

Function Join()

Joins an unknown number of values together, and separates each with one or more specified characters. This is useful for creating lists from a data set, commonly these would be comma separated.

This is an aggregate function

Syntax
Join( s, r )

ParametersDescription
sThe Separator is used to separate the items in the second parameter.
rThis is a reference to a question in a repeating page, repeating section or multiple row data source

Function JoinAnd()

Joins an unknown number of values together, with more complex separation rules to form a proper sentence from a data set. This function is very similar to Join(), except that it allows you to specify a different separator to use before the last item joined.

This is an aggregate function

Syntax
JoinAnd( s, l, r )

ParametersDescriptions
sThe separator is used to separate all but the last item.
lThe separator used for joining the last item.
rThis is a reference to a question in a repeating page, repeating section or multiple row data source

Function JsonEncode()

Encodes a string so it is safe to use in JSON. Especially useful to encode values provided by users that are being used by subsequent REST calls.

Syntax
JsonEncode(value)

Function Left(), Right() and Substring()

Left(), Right(), and Substring() return a portion of a larger text string, used primarily for manipulating data that is received in an unusable format.

Syntax

left(o, v) right(o, v) substring(o,s,v)

ParametersDescription
oOriginal value, or question reference.
sA numeric value representing the character position where the sub-string begins. A value of 1 indicates the first value in the text.
vA numeric value representing the length of the substring to be returned.

Function Length()

Length() returns the number of characters in a value or question reference.

Syntax

length(o)

ParameterDescription
oOriginal value, or question reference.

Function ProperCase()

Using specified characters, words and terms the propercase() function will capitalize text to suit the situation. Although it is possible to capitalize the first or each letter within a string of text the propercase() function caters for more complex examples such as MCDONALD and SMITH-JONES.

Syntax

ParametersDescription
oOriginal value, or question reference.
iWords to ignore or exclude from capitalisation such as and, the, of, etc.
tTerms after which to capitalise the next letter such as ‘ Mc’, ‘-’, etc.

some words excluded from capitalization: and, the, of

acronyms and abbreviations do not work with the proper case function

Function RegexMatch()

Compares a pattern against a target and returns whether the target matches the pattern

Syntax
RegexMatch(p,t,[caseInsensitive])

ParametersDescription
pregex pattern
ttarget string
c(optional) case sensitivity; 1 for insensitive, 0 for sensitive

An error will be returned by the function if the supplied pattern can't be parsed as a regular expression.

Function RangeIndex()

Takes an expression value and range values which are indexed from 0. Where the expression value is greater than a range value, this function returns the index of the last range value that is less than the expression value.

Syntax
RangeIndex ( e, r1 [, r2] [, r…] )

ParametersDescription
eAny valid expression that resolves to a number. This may include standard formulas, function calls and question references, e.g. [q1] + [q2].
r1The starting number of the first range. If the expression in e is found to be equal or greater than this value, but less than the value in the next range parameter (if provided), then the RangeIndex function will return 0.
r2, ...(Optional) The starting number of the second or subsequent ranges. If the expression in e is found to be equal or greater than this value, but less than the value in the next range parameter (if provided), then the RangeIndex function will return the index of this parameter.

Function Replace()

Returns a value where a specified character or term has been replaced with another value.

Syntax

Replace( o, f, r )

ParametersDescription
oOriginal Value
fCharacter or term to find
rValue to replace the found text with

Function StartsWith() and EndsWith()

Determines if a value starts or ends with a particular value or reference. The functions resolve to 1 or 0, i.e. true or false.

Syntax
StartsWith( o, f)

EndsWith( o, f)

ParametersDescription
oOriginal value, or question reference.
fValue to find within the original value or reference.

Function UrlEncode()

Converts a specified string and applies HTML encoding so it is safe to use in a URL.

Syntax

UrlEncode(s)

ParameterDescription
sThe string to encode

Function Switch()

Switch takes the first parameter and compares it against a list of matches, returning a corresponding value.

Syntax

Switch(c, m1, r1, [, m…] [, r…] [, d])

ParameterDescription
cThe value being compared to
m1, m...the value/s being matched to the comparison value
r1, r...the equivalent return value/s when a match has been made
d(optional) default value to return if there are no other matches

If a match is not found the optional default value is returned. If not default is specified a blank string ("") is returned.