InfoPath functions with examples

A list of commonly used functions in InfoPath with examples of how those InfoPath functions can be used in formulas.

Functions in InfoPath can be used by themselves or embedded in other functions as an argument that uses the result of the embedded function to form formulas.

Below you will find a list of commonly used functions in InfoPath with a short description of what they do, and references to articles that use a particular function.

 

addDays(date, days)

Add days to a date or date and time.

 

avg(field)

Calculates the average of all of the numerical values in a field or group.

 

concat(text1, text2, ...)

Combines two or more fields or text strings into one text string.

 

contains(within_text, find_text)

Returns true if the first field or text string contains the second. Otherwise it returns false.

 

count(field)

Counts the number of instances of a field or group.

 

eval(field, expression)

Returns the values of a field or group. The second argument defines the expression to calculate for the field or group. Usually, the eval function is nested within a function that operates on a field or group, such as sum or avg.

 

floor(number)

Rounds a number down to the nearest integer.

 

max(field)

Returns the largest number in a field or group.

 

min(field)

Returns the smallest number in a field or group.

 

not(boolean_value)

Removes whitespace from a text string.

 

now()

Returns the current system date and time.

 

number(value)

Converts a value to a number.

 

string-length(text)

Returns the number of characters in a text string.

 

substring(text, start_position, char_count)

Returns a specific part of a text string. The second argument specifies the starting position and the third argument specifies how many characters to include.

 

substring-after(text, find_text)

Returns the text in the first text string that follows the first occurrence of the second text string.

 

substring-before(text, find_text)

Returns the text in the first text string that precedes the first occurrence of the second text string.

 

sum(field)

Returns the sum of all fields in a field or group. Each field is first converted to a number value.

 

today()

Returns the current system date. For SharePoint list date fields, use the now() function.

 

translate(text, find_chars, replace_chars)

Returns the first text string with each character in the second text string replaced by the character at the corresponding position in the third text string.

 

userName()

Returns the user name of the person filling out the form (Microsoft InfoPath 2007 and later).

 

 Subscribe for updates via RSS or Email
InfoPath 2013 Cookbook: 121 Codeless Recipes for Beginners

InfoPath 2013 Cookbook 2: 121 Codeless Recipes for SharePoint 2013

InfoPath 2010 Cookbook: 101 Codeless Recipes for Beginners

InfoPath 2010 Cookbook 2: 101 Codeless Recipes for SharePoint 2010

InfoPath 2010 Cookbook 3: 101 Code Recipes for C# Developers

InfoPath 2010 Cookbook 4: 101 Code Recipes for VB Developers

InfoPath 2010 Cookbook 5: Integrating InfoPath with Excel and Excel Services