Load customer segment members

This sample demonstrates how to load customer segment member data with the Data Load utility. After you load the data, Management Center users can view, manage, and use the customer segment in the Marketing tool.


About this sample

We can load data for adding customer segment members to customer segments in CSV formatted input files. The sample CSV input file and data load configuration files for this sample are in the following directory:


Sample input and configuration files

The following table lists the input files that we use to load the sample data. The table also identifies the business object mediators and business object configuration files that the Data Load utility uses to load the sample data.

Sample CSV input file Description
TestCustomerSegment.csv This sample file includes only a single column of email addresses. The file does not include any column or file header information. When we are loading a list of email addresses to create a customer segment, you do not need to include any header information.

The Data Load utility uses this sample input file to load the list of email addresses to create a customer segment in the Marketing tool. This sample also populates the customer segment with members.

The Data Load utility uses the following business object mediator to load the data in this input file into the MBRGRP database table.

Business object mediator

com.ibm.commerce.member.dataload.mediator.MemberGroupMemberMediator

The sample directory also includes the following Data Load utility configuration files:

These configuration files include values for a default WebSphere Commerce Developer environment that uses an Apache Derby database. If the environment settings are different, we must change the configured values in these files to match the environment.


Procedure

  1. (Developer) On a command line, go to the WCDE_installdir\bin directory.

  2. (Linux) Open a command line in the Utility server Docker container. Change the directory to utilities_root/bin directory.
    For information about entering and leaving containers, see Running utilities from the Utility server Docker container.

  3. Enter the following command to run the sample data load order file and load the information that included in this sample:

    • (Linux) ./dataload.sh ../samples/DataLoad/Member/CustomerSegment/wc-dataload.xml

    • (Developer) dataload ..\samples\DataLoad\Member\CustomerSegment\wc-dataload.xml

When the load process completes, a new customer segment is created. The customer segment name is the same as the input file name, TestCustomerSegment.


Verifying results


Removing the sample data from the WebSphere Commerce database

To remove the sample data from the database, run the sample again with the utility in delete mode. Edit the wc-dataload.xml load order configuration file to change the value of the dataLoadMode attribute from "Replace" to "Delete" to run the Data Load utility in delete mode. When you run the utility in delete mode, the utility deletes the data in the database that matches the rows in your CSV file. You do not need to edit the value for Delete column in your input CSV file. Alternatively, we can run the Cleanup.sql file for this data load sample. The Cleanup.sql file is located within the following directory:

From a command prompt, connect to the database with your user ID and password. Run the following command (DB2)

(Oracle)

Verify that the data is removed from the database by running the following SQL statements:

The data that you loaded with this sample should no longer exist in the database.

In Management Center, verify that we can no longer view the customer segments in the Marketing tool.