Named Item Lists in Document Publisher
When working with large datasets it is sometimes convenient to cache the returned items for re-use in multiple tags. Document Publisher makes this possible using named items lists. These are created from the User Variables dialog.
Creating an Item List
To create an item list you need to:
- From an open template select Tools > User Variables
- This produces the Variables dialog. Locate the predefined $ItemList entry
- Add a new entry in the Value column. This is a comma separated list of all the named item lists in your template
- Press OK to save the variable and your item list is now ready to use in a tag
Populating an Item List
Once you have generated a suitably named list you must create a Paragraph Group tag to populate the list. For further information on how to create a Paragraph Group tag please click here. No output is to be generated from this tag, its sole purpose is to fill the item list for subsequent tags to use.
- Create the Paragraph Group tag at an appropriate place in the document, this must appear before the tags which are to use the item list
- Within Tag Properties find the Hierarchy property and click … to create a new hierarchy
- Edit the hierarchy and set the appropriate item selection(s)
- For each node set the Document Section property to <None> so that no output will be generated
- Select your newly created item list in the Item List property
- If the same list is being filled multiple times then set the Clear Cache property depending on if you want to refill the list from scratch or append to the existing list
- Press OK to save the hierarchy
Please note that duplicate items are automatically removed from item lists as they are filled.
Using an Item List
Once a Paragraph Group tag has been setup to fill your item list, it can be used by any tag appearing after it in the template document.
- Create a Paragraph Group or Table tag at an appropriate location in your template
- Set the tag‘s item selection to match what information is stored in the item list
- Optionally, create a hierarchy to follow from the items stored in the list
- Optionally, override the Sort By property if it needs to be different from the item list sorting order
- Expand the item selection and set the Identity property as shown below, using the special value $ItemList followed by a colon and then the name of the list to use it
Referencing an Item List in a Filter
There are two special filter properties that can be used to check for the existence of items stored in an item list. These are available in the Filter dialog as Link Attributes:
- Exists in Item List – where the filter expression will evaluate to true if the item exists in the named item list
- Is Linked to Item in Item List – where the filter expression will evaluate to true if the item is linked via a specified link type to an item that exists in a named item list