Reflects the current release of Nintex for SharePoint 2016. For your version, please access assistance through the Help button in the product.
The lookup function allows a form designer to retrieve data from a column within a SharePoint list and display that data on a form or use it in a formula.
A common requirement among form designers is the ability to surface SharePoint data from another list and optionally process that data. Displaying an entire list item or a list view is possible with the List Item and List View controls respectively, however these controls render html as their output which cannot be processed in a Nintex formula. In scenarios where you want to obtain a value from a list column, for display or processing in a formula, the lookup function is a viable approach.
Within a Nintex Form, the lookup function can be used within a:
To understand how the lookup function determines what data to bring back, consider the following lookup function:
lookup(“listA”, “ID”, 1, “Title”)
This lookup will send a query to SharePoint, asking for list items within a list titled ‘listA’ and return the Title column value from any list items whose ID column value is 1.
Note: The match on the value is case-insensitive.
The lookup function does not support complex query construction; it determines what list items are included, as data to bring back, based on the filter column being an exact match to the value you specify. You can compose complex formulas with the formula builder if you need to build up a complex query, however be mindful that each lookup function will send an individual request to SharePoint for data.
list title: The title of list that contains the data you are querying.
column to filter on: The name of the column in the list that you want to filter on. Specifically, this column will be used to filter which list items are treated as matches against the third parameter.
value to filter on: The value you specify for this parameter is compared against each item in the list, if it matches the value for the column you specify in the second parameter, the list item data is returned.
output column: The name of the column in the list that you want to get data from. Data from the output column is returned in the formula.
multiple values <optional>: Used to signify that you want multiple values returned from the lookup function. This should be used if there are more than one list item which matches the filter you’ve configured and you want an array of values to be returned.
value data type <optional>: Use to manually set the underlying data type that SharePoint will compare your value as.
The list you are querying can exist within the current site, or within sites within the current site collection.
The following types of data are supported for the ‘value to filter on’ parameter:
Note: Null is a valid input value.
The lookup function does not currently support multiple values being passed in as the input value parameter. Only a single value is supported. I.e. you cannot pass an array of values into a lookup function.
The returned column value will not be formatted by the lookup function unless it’s one of the following SharePoint types:
For Example: Given a SharePoint Person column, the displayed value of a Person column in SharePoint may appear as “User A”, but the underlying SharePoint text is of the format “1;#UserA”.
If a lookup function is configured to return a Person column’s value, it will convert it into text, using the internal format of “1;#UserA”.
By default, the data returned from this function is for a single column in a list. You may want to return multiple column values: For example, where multiple list items matched a given query. To do this, append ‘true’, without the quotes, as the last parameter of the function. For multiple output values, they are returned inside an Array.An array is of the format [value1,value2].
You can use a Named Control, Item Property, Form Variable, Workflow Variable or a pre-defined property as the input value of a lookup function. All types of data to insert are listed in the Formula Builder dialog.
Note: Quotes are not necessary when inserting a control, property or variable.
The lookup function is dynamic; if any parameters that are passed into the function change during runtime, the lookup function re-fetches the data and triggers the formula to re-evaluate.
All lookup data is cached for 2 minutes to reduce network traffic.
All lookup functions are evaluated on load of a form, unless they are configured to not recalculate on view mode. This option is per control in the control property window.
Lookup functions are processed asynchronously, meaning they do not halt the form from operating while they fetch the SharePoint data and evaluate. This helps in scenarios where the network between you and the data is slow or physically far apart.
Lookup functions currently do not work in Nintex external forms.
Formulae that depend on other formulae containing a lookup function will not wait before evaluating. Consider the following scenario of two Form Variables:
Variable A has the formula: Variable B + 1
Variable B has the formula: lookup(“listA”, “Title”, “Task1”, “ID”)
Variable A depends upon Variable B, however an individual formula only waits until all endogenous lookup functions are complete before evaluating. The result is that Variable A will momentarily evaluate to ‘1’, as Variable B has not yet completed. When Variable B does complete, it notifies Variable A to re-calculate, at which time Variable A displays the complete value of: ‘<Variable B’s lookup value> + 1’.
If you have multiple, dependent lookup formulae and require all lookup functions to be complete before displaying a result to the user, utilize a single formula with nested or chained lookup functions.
The lookup function performs the lookup of SharePoint data as the current user. Therefore, if the user filling out a Nintex Form does not have the necessary SharePoint access to the list or list item(s), the lookup function will not return any data.
Lookup functions can be nested inside of other lookup functions. Lookup functions will evaluate inside out, (for example, a lookup function inside another lookup function will evaluate first) to maintain formula correctness.
As a form designer, be mindful not to construct a formula which contains a circular reference. A circular reference is where a formula is dependent on another formula to complete, but that formula depends upon the original formula completing.
If a circular reference is accidentally configured, the lookup function will stop evaluating after a fixed number of cycles.
To help with troubleshooting issues, preview your Nintex Form and press F12 to open the IE developer toolbar. Next, click on the Script tab and ensure that the Console tab on the right is selected. Refresh your preview window by right clicking and selecting Refresh.Logging will appear in the window, and help you to troubleshoot common misconfiguration/data access issues.