JungleDocs | Reverse lookup function
JungleDocs reverse lookup function allows you to easily export items from SharePoint into a specific list given they have a common lookup value. For example, if you have a Contacts list, and the list has a lookup column linking to Company Name column in the Companies list, you can easily generate a report of that company contacts by running JungleDocs from the Companies list. In order to be able to that, you must configure the corresponding JungleDocs template, JungleDocs rule, and content type.
In this tutorial, you will learn how to use this function.
A mandatory requirement for the reverse lookup to work is a lookup column in your content type that you use to generate the reverse lookup report.
in the case of the example above, you need to add the lookup column linking to the Companies list.
- Go to content type settings and click Add from new site column:
- In the new window, enter column name (e.g., Company) and select Lookup as column type:
- Select the lookup list and column name. In our case it is Companies list and Company Name column:
- Select if you want to include any other columns from Companies list and click OK. Once you have the lookup column, you can edit the JungleDocs rule and template.
- Go to the Companies list, run JungleDocs and click New From Existing rule:
- In the new window select target library and Base rule:
- Choose document template:
- Set miscellaneous settings like rule name and visibility.
- Also map the target content type - Company column - to the source list (Company Name column), because the Contacts list also has a lookup column linking to the Company Name column:
- Click OK to save the settings.
Now that we have configured the content type and the JungleDocs rule, we only need to configure the template.
Note: 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 a ReverseLookup() function. It has to be specified in the following format: LookupColumn:ReverseLookup("List Containing the items"). The column we previously added to the content type must be the same column that your soon-to-be-exported items have. In our case it is Company. List Containing the items is the list where your soon-to-be-exported items are stored. In our case it is the Contacts list. The final formula for the content control looks like this: Company:ReverseLookup("Contacts")
- To create the repeated section in the template, start editing the template. Run JungleDocs, start editing the rule we previously created, start editing the base rule and click "Edit template":
- Once you open the template, create a table, select a row and add a rich text content control:
- Open control properties:
- Enter Company:ReverseLookup("Contacts") in the Tag field:
- 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 are trying to resolve items from a list that is on a different site, you can use Site/list in the reverse lookup command. So the command from this example would look like this: Company:ReverseLookup("Sales/Contacts") if you are running JungleDocs from a site different than Sales.