Walkthrough: Preparing Sitecore for synchronizing a text file

Version: 8.0

This walkthrough is part one of Synchronizing data from a text file to Sitecore walkthrough series and describes how to prepare for constructing a data synchronization of a text file.

The walkthrough describes how to:

  • Create a text file with test data

  • Create a tenant in Sitecore

  • Create a target item template

  • Add a parent item for target items

Create a text file with test data

This example source file contains information about cities. Each row in the file represents a different city. The first line in the file contains the names of the columns in the file.

Note

You only need this file in order to complete the walkthrough series. It has no purpose other than as an example.

To create this source file in Data Exchange Framework:

  1. Create a new file, for example, C:\Sitecore\cities.dat

    Important

    You can place this file wherever you want, but it must be accessible from your Sitecore server. This includes file permissions.

  2. Add the following text to the file:

    RequestResponse
    id,country,city
    fr1,France,Paris
    dk1,Denmark,Copenhagen
    jp1,Japan,Tokyo
    us1,United States,New York
    us2,United States,Los Angeles
    
  3. Save the file.

Create a tenant in Sitecore

A tenant is the parent item for all of the settings related to a set of related data synchronization processes. In this example, you use a tenant to group the settings needed to read data from a text file and to create Sitecore items from that data.

To add a tenant:

  1. In the Content Editor, navigate to /sitecore/System/Data Exchange.

  2. On the ribbon, on the Home tab, click Empty Data Exchange Tenant to add a new tenant, and name it File System Provider Test Tenant. Click OK.

    Note

    While Sitecore is creating the tenant, it displays the progress in the Creating tenant dialog.

  3. When the tenant has been created, in the content tree, select the new tenant, for example, sitecore/System/Data Exchange/File System Provider Test Tenant.

  4. On the Content tab, select the Enabled check box.

  5. Save the item.

Create a target item template

In this walkthrough each row from the source text file represents information about a city. The data synchronization process maps the data from the text file to a Sitecore item. In order to store this information you must create a Sitecore template to store this information, add an icon to the template, and assign the data fields to the template.

To create a template:

  1. In the Content Editor, navigate to Templates. On the menu ribbon, on the Home tab, in the Insert group, click New Template.

  2. In the Select name dialog, enter the following values:

    Name

    City Information

    Base template

    Templates/System/Templates/Standard Template

    Select name dialog with Name and Base template fields filled in
  3. Click Next.

  4. In the Location dialog, select Templates/User Defined. Click Next. In the confirmation dialog, click Close.

  5. To set an icon for the new template, in the content tree, select the template, for example, Templates/User Defined/City Information.

  6. In the right-hand pane, on the Content tab, click the icon next to title.

    City Information icon on Content tab
  7. In the Change Icon dialog, in the Icon field, enter, for example, Office/32x32/pin.png

  8. To add fields to the template, on the Builder tab, type Data in the Add a new section field.

  9. In the Data section, add the following fields:

    Name

    Type

    Shared

    Identifier

    Single-Line Text

    selected

    Country

    Single-Line Text

    City

    Single-Line Text

    When you have finished, the section looks like the following:

    Added fields in Data section
  10. Save the item.

Add a parent item for target items

The data synchronization process creates a Sitecore item for each row in the text file. These target items represent, for example, the cities described in the text file. The data synchronization adds the city items as child items under a Sitecore parent item.

You must create the parent item before the synchronization can create the child items.

To add a parent item:

  1. In the Content Editor, navigate to /sitecore/Content.

  2. On the ribbon, on the Home tab, in the Insert group, click Insert from template.

    Insert from template option on the ribbon
  3. In the Insert from Template dialog, in the Template field, select Templates/Common/Folder. In the Item Name field, enter Cities.

    Insert from Template dialog
  4. Click Insert.

Do you have some feedback for us?

If you have suggestions for improving this article,