# Dynamic Collection

Dynamic Collections are a complex and powerful component that allow you to get data from any of these sources:

  • Sitecore items
  • Sitecore search
  • External API

and map it to any component you have created. It also comes with integrated paging features, as well as integration with Flex Forms in query mode, which allows search based dynamic collections to read querystrings and refresh their own search data.

Use whenever you need data-based results as opposed to manually entered content.

# Setting up a dynamic collection

Dynamic Collection Options

After selecting a dynamic collection in component editor, press the Manage button in the Dynamic Collection options in the right-hand menu.

# Select a Component

Dynamic Collection Step 1

The first step will be selecting a component you have built previously to populate with data. You will see a preview of the selected component at the bottom of the modal. After selecting the component you want to use, you will have multiple options for the type of data to populate it with.

# Search Data

Search Data

This data is based off of Sitecore's internal search, and comes with multiple filters and fields for you to use.

# Filters

Filters will set up the default search for the collection, as well as fetch sample data for you to map in the next step.

  • Search Term: keyword based search, as if you were typing data into Google. This will search all the text fields of a page.
  • Category: Mutually-exclusive category based on /sitecore/templates/Foundation/Settings/_PageTaxonomy
  • Tags: Tags based on /sitecore/templates/Foundation/Settings/_PageTaxonomy.
  • Template Name Filter: Text based filter for template names to restrict results to. Pipe delimited for multiple values.
  • Root Item: The starting point of your search in the Sitecore content tree
  • Date From: The search date starting point. This will obey Publishing Date (from /sitecore/templates/Foundation/Articles/_Article), then modified date.
  • Date To: The search date end point. This will obey Publishing Date (from /sitecore/templates/Foundation/Articles/_Article), then modified date.
  • Sort By: Default sorting will obey Solr search engine rules. Choices are based on configuration settings located at /sitecore/system/Settings/Foundation/Search/Sort Options
  • Page Size: How many results to display at once
  • Pages Only: Only bring back actual pages and not data item, based on the presence of presentation details in Sitecore

# Available Fields

  • ID: Sitecore item ID
  • Name: Sitecore item name
  • Path: Sitecore item path
  • URL: Sitecore generated relative URL of the item
  • Main Link: Based on /sitecore/templates/Foundation/Search/Base/_Linking. Used for data items that need to link to something else, such as a media item or an external URL.
  • Location: Based on /sitecore/templates/Foundation/Articles/_Article
  • Publication: Based on /sitecore/templates/Foundation/Articles/_Publication
  • /sitecore/templates/Foundation/Search/Base/_SearchDescription
    • Main Title: Friendly Search Title
    • Main Image: Image used for internal search results
    • Article Summary: Description used for search results
    • Main Image Caption: Rich text field used for image captioning
  • /sitecore/templates/Foundation/Settings/_PageTaxonomy
    • Category: Mutually exclusive category
    • Tags: All tags the item has

# Item Data

Item Data

This will bring back the children of the given item and all the fields they have. Use the item's ID in Sitecore.

# External API Data

External API Data

This lets you select from complex API calls located at /sitecore/content/Data/External APIs. The API system will let you perform POST, GET, etc. calls to external APIs and return that data for the dynamic collection mapper. Keep in mind the data must be returned as a JSON array to be used.

# Map the Data

Data Mapping

Flex will automatically navigate both your component and the external data to bring back mappable JSON paths. Select the component atom you want to map on the left, and what data you want it to map to on the right.

The preview window at the bottom will show the selected atom, and when you select a mapping, will map the sample data for you.

When done, click "Update" at the bottom of the modal and view the finished collection.