Lookup data from another list inside a Nintex Form
Background
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 the aforementioned 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.
An example would be a purchase order form whose list of purchasable items is maintained in a central list within SharePoint.
Henceforth is an example of how to use the Lookup function.
A Purchase Order utilizing the Lookup function
Given a Products list containing the following purchasable items:
We want to create a Nintex form allowing a user to purchase items from a centralized list. The first step is to create our Nintex Form with a Lookup control that is connected to the Products list.
Let’s preview the form. We see that the control displays each item in the Products list as a selectable item in the dropdown:
Next, users should be able to purchase multiple items; let’s put this control inside a repeating section and add a text box to capture the quantity of each item.
Great – users can purchase different types of products and various quantities of each. Next, we want to show to the user the price of each item they select. To do so, we make use of the Lookup function.
The Lookup function
The lookup function allows a form designer to get data from a column within SharePoint.
As mentioned, we want to display the associated price of a given product depending on what the user selects to purchase. To do so, we drag on a calculated value control and configure it as follows:
In the above screenshot you can see the filled out function. The first parameter tells the function to access a list called “Products”. We need to tell the function which item in the products list we are interested in, as we only want column data for one list item, not all of them.
The second and third parameters are for this purpose, it specifies which column to filter on (ID in this case) and the value in that column that should be matched against. You’ll notice that the third parameter is red and underlined. That is because it is a ‘named control’. I.e. the value comes from the lookup control we put on the form to allow users to select a product. This formula is now dynamic. When the ‘Product’ control’s value changes, this formula is re-run.
The last parameter is ‘Price’. This is the column name which we want to bring back and display.
Let’s hit preview and have a look:
In the above animation you can see the behaviour of the lookup function as it fetches the price upon product selection in the dropdown.
Comments
Post a Comment