Reverse lookup function
Applies to JungleDocs for SharePoint 2010-2019.
For JungleDocs for Office 365 tutorials, click here.
JungleDocs reverse lookup function allows you to easily export items from multiple SharePoint lists to a custom document, given that those lists have a common lookup value. In this tutorial, you will learn how to use this function.
Content type and rule configuration
In the example described below, we have the Contacts list which has a lookup column linking to the Company Name column in the Companies list. Using JungleDocs, we're going to generate a report of the selected company's contacts. In order to be able to that, we have to configure the corresponding content type, JungleDocs rule, and template.
For the reverse lookup to work, you need a lookup column in your content type that you use to generate the reverse lookup report. In the example, you need to add the lookup column linking to the Companies list.
1. Go to content type settings and click Add from new site column:
2. In the new window, enter column name (e.g., Company) and select Lookup as column type:
3. Select the lookup list and column name. In the example, it is the Companies list and the Company Name column:
4. Select if you want to include any other columns from the Companies list and click OK.
5. In the Companies list, open JungleDocs, select the From Existing tab, and click New rule.
6. In the new window select a target library and Base rule:
7. Select a document template.
8. Set miscellaneous settings like rule name and visibility.
9. Also map the target content type - the Company column - to the source list (Company Name column), because the Contacts list also has a lookup column linking to the Company Name column:
10. Click OK to save rule settings.
Now that we have configured the content type and the JungleDocs rule, we only need to configure the template.
Template configuration
In order to generate a report, we need to create a repeated section in the document template. The repeated section overlaying content control will use the
LookupColumn
The column we previously added to the content type must be the same column that our soon-to-be-exported items have. In the example, it is the Company column. In the funcion, List Containing the items is the list where our soon-to-be-exported items are stored. In the example, it is the Contacts list. The final formula for the content control looks like this:
Company
1. Open JungleDocs, click on the down-arrow icon next to the rule you've previously created, then click Edit template:
2. Once you open the template, create a table, select a row and add a rich text content control:
3. Open control properties:
4. In the Title and Tag field, enter the following function:
Company:ReverseLookup("Contacts")
5. Format the table according to your requirements, add other content controls for other fields from the Contacts list, and your repeated section is ready:
Now you can select a company, run JungleDocs rule that you previously created, and you will get a list of contacts for that company.
Note
If you want to resolve items from a list that is on a different site, you can use Site/list in the reverse lookup command. For example, if you are running JungleDocs from a site other than Sales, the function would look as follows:
Company:ReverseLookup("Sales/Contacts")