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 Companies list, Company Name column, you can easily generate a report of that company contacts, by running JungleDocs from Companies list.
In order to be able to that, you must configure JungleDocs template, JungleDocs rule and Content type accordingly.
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.
Considering the previous example, 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 "Company" for example and select column type as "Lookup":
- 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 we have the lookup column, we can edit JungleDoc rule and template.
- Go to the Companies list, run JungleDoc and create a "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 our contacts list also has a lookup column linking to the "Company Name" column:
- Click OK to save the settings.
Now that we have configured content type and JungleDocs rule, we just need to configure the template.
Note: In order to generate a report, we need a repeated section.
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, it must be the same column that your soon to be exported items have, in our case the "Company".
List Containing the items – list where your soon to be exported items are stored, in our case the "Contacts" list. So in our case 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:
- Then click "Properties":
- And 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.