FRAMES | NO FRAMES
CustomerProspecting Method

Locates areas with nearest demography characteristics to the given profile.

Availability: Business Analyst Server.

TaskResultOutput CustomerProspecting ( 
    CustomerProspectingParameters  Parameters, 
    esriReportFormat               ReportFormat, 
    RenderingParameters            RenderingParameters, 
    TaskOutputType[]               OutputTypes, 
    esriFolderItem                 OutputAnalysisItem 
);

Parameter Description
Parameters Configuration options for customer prospecting. Type CustomerProspectingParameters.
ReportFormat This parameter should be null. This parameter is deprecated.
RenderingParameters Configuration options for rendering output when GetMapImage option is specified in the OutputTypes parameter. Type RenderingParameters.
OutputTypes Array of task output options. Options for this method include rendering output image (GetMapImage) and creating a feature layer for subsequent analysis (GetFeatureClass). Type TaskOutputType[].
OutputAnalysisItem (Optional parameter — can be null).
Configuration options for storing the output feature layer in the repository. This will enable viewing and working with the output result in subsequent tasks. Type esriFolderItem.

Returns

Variable of type TaskResultOutput

Remarks

The Customer Prospecting allows you to search for areas (standard geographies) that meet certain criteria. This criteria is usually determined by the CustomerProfiling method.

This task generates an output feature layer by querying a demographic data layer (for example, ZIP Codes, census tracts, block groups, and so forth) based on the parameters set. This new layer will contain all the variables defined in the query and will only display features of that layer that met the query criteria.

How to set up your query

If you want to profile the customers of a national women's clothing retail chain based on your results from the Customer Profiling tool (or internal metric), and you have determined that your customers have a median household income of $35,000, a median age of 30, and are predominately female, you could set up your query to search for these parameters at the block group level. When prospecting your customers, it is recommended that you set a range for these values, since it is unlikely you will find many (if any) block groups that would have all these specific values.

NOTE: These variances can be set in the CustomerProfiling method and you can import its output Customer Profile string into parameters of the CustomerProspecting method.

The resultant output feature layer would contain all the block groups that met the requirements set in your Customer Profile. In other words, you would be able to see all the block groups that would be likely to contain customers that you would expect to shop at your retail stores within your market (or boundary layer).

Usage Tips

Examples

The example below generates an analysis layer of areas of interest based on specified demographic and marketing characteristics of a given list of customers using the Principal Components Analysis option. The analysis layer is saved to the repository.

NOTE: See FindSimilar samples for an example of using the conventional analysis option.

C#
// Instantiate the BAServerHelper class to access analysis methods
BAServerHelper baServerHelper = new BAServerHelper();
baServerHelper.ActiveDatasetID = "USA_ESRI"; // Optional parameter
baServerHelper.IsFullErrorMessage = true;    // Default is false
 
RenderingParameters imageOptions;
TaskOutputType[] outputOptions;
esriFolderItem outputLayer;
esriFolderItem outputReport;
 
// ========= STEP 1: Create a record set by customer addresses
 
RecordSetByAddress[] customerAddresses = new RecordSetByAddress[7];
 
customerAddresses[0] = new RecordSetByAddress();
customerAddresses[0].Name = "customer1";
customerAddresses[0].Description = "Ocean Beach Customer";
customerAddresses[0].StoreID = "1";
customerAddresses[0].Address = "5080 Newport Ave.";
customerAddresses[0].City = "San Diego";
customerAddresses[0].State = "CA";
customerAddresses[0].ZIP = "92107";
customerAddresses[0].CustomerID = "1";
 
customerAddresses[1] = new RecordSetByAddress();
customerAddresses[1].Name = "customer2";
customerAddresses[1].Description = "La Jolla Customer";
customerAddresses[1].StoreID = "1";
customerAddresses[1].Address = "1250 Prospect St.";
customerAddresses[1].City = "La Jolla";
customerAddresses[1].State = "CA";
customerAddresses[1].ZIP = "92037";
customerAddresses[1].CustomerID = "2";
 
customerAddresses[2] = new RecordSetByAddress();
customerAddresses[2].Name = "customer3";
customerAddresses[2].Description = "Pacific Beach Customer";
customerAddresses[2].StoreID = "1";
customerAddresses[2].Address = "1762 Garnet Ave.";
customerAddresses[2].City = "San Diego";
customerAddresses[2].State = "CA";
customerAddresses[2].ZIP = "92109";
customerAddresses[2].CustomerID = "3";
 
customerAddresses[3] = new RecordSetByAddress();
customerAddresses[3].Name = "customer4";
customerAddresses[3].Description = "Morena Customer";
customerAddresses[3].StoreID = "1";
customerAddresses[3].Address = "1240 W. Morena Blvd.";
customerAddresses[3].City = "San Diego";
customerAddresses[3].State = "CA";
customerAddresses[3].ZIP = "92111";
customerAddresses[3].CustomerID = "4";
 
customerAddresses[4] = new RecordSetByAddress();
customerAddresses[4].Name = "customer5";
customerAddresses[4].Description = "Clairemont Customer";
customerAddresses[4].StoreID = "1";
customerAddresses[4].Address = "6393 Balboa Ave.";
customerAddresses[4].City = "San Diego";
customerAddresses[4].State = "CA";
customerAddresses[4].ZIP = "92111";
customerAddresses[4].CustomerID = "5";
 
customerAddresses[5] = new RecordSetByAddress();
customerAddresses[5].Name = "customer6";
customerAddresses[5].Description = "Bird Rock Customer";
customerAddresses[5].StoreID = "1";
customerAddresses[5].Address = "5735 La Jolla Blvd.";
customerAddresses[5].City = "La Jolla";
customerAddresses[5].State = "CA";
customerAddresses[5].ZIP = "92037";
customerAddresses[5].CustomerID = "6";
 
customerAddresses[6] = new RecordSetByAddress();
customerAddresses[6].Name = "customer7";
customerAddresses[6].Description = "University City Customer";
customerAddresses[6].StoreID = "1";
customerAddresses[6].Address = "3254 Governor Dr.";
customerAddresses[6].City = "San Diego";
customerAddresses[6].State = "CA";
customerAddresses[6].ZIP = "92122";
customerAddresses[6].CustomerID = "7";
 
TaskResultOutput recordSetResult =
    baServerHelper.CreateRecordSetByAddresses(customerAddresses, esriFolderType.esriFolderCustomerLayers);
 
TableData tableData = new TableData();
tableData.RecordSet = recordSetResult.RecordSet;
GeocodeData geocodeData = new GeocodeData();
geocodeData.Table = tableData;
 
// ========= STEP 2: Geocode the record set with customers
 
CustomerStoreSetupByGeocodeTableParameters geocodeParameters = new CustomerStoreSetupByGeocodeTableParameters();
 
// Set specific analysis parameters
geocodeParameters.GeocodeCustomers = true;
geocodeParameters.GeocodeData = geocodeData;
geocodeParameters.LinkField = "STORE_ID";
geocodeParameters.NameField = "NAME";
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
outputLayer = null;
 
TaskResultOutput geocodeResult =
    baServerHelper.CustomerStoreSetupByGeocodeTable(geocodeParameters, imageOptions, outputOptions, outputLayer);
 
PointLayer customerLayer = new PointLayer();
customerLayer.RecordSet = geocodeResult.RecordSet;
 
// ========= STEP 3: Execute the CustomerProfiling analysis
 
CustomerProfilingParameters profilingParameters = new CustomerProfilingParameters();
 
// Set specific analysis parameters
profilingParameters.AnalysisExtent = null;
profilingParameters.Customers = customerLayer;
profilingParameters.DataLayerID = "US.BlockGroups";
profilingParameters.Summarizations = new string[] { "MEDHINC_CY", "TOTHH_CY", "TOTHH_FY" };
 
string customerProfile = baServerHelper.CustomerProfiling(profilingParameters);
 
// ========= STEP 4: Create a boundary layer from standard geographies
 
// The San Francisco County study area is selected as the boundary
StandardLevelsOfGeographyParameters geographyParameters = new StandardLevelsOfGeographyParameters();
 
// Set specific analysis parameters
geographyParameters.AppendFields = false;
geographyParameters.DataTable = null;
geographyParameters.GeographyFeaturesBehavior = esriStdGeographyType.esriStdGeographyTypeFirst;
geographyParameters.GeographyIDs = new string[] { "06075" }; // FIPS ID code for San Francisco County
geographyParameters.GeographyLevelID = "US.Counties";
geographyParameters.TableIDField = null;
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
outputLayer = null;
outputReport = null;
 
TaskResultOutput geographyResult =
    baServerHelper.StandardLevelsOfGeography(geographyParameters, imageOptions, outputOptions, outputLayer, outputReport);
 
PolygonN polygon = (PolygonN)geographyResult.RecordSet.Records[0].Values[1];
ExtentData extentData = new ExtentData();
extentData.Extent = polygon.Extent;
 
// ========= STEP 5: Execute the CustomerProspecting analysis
 
CustomerProspectingParameters parameters = new CustomerProspectingParameters();
 
// Set specific analysis parameters
parameters.AnalysisExtent = extentData;
parameters.CustomerProfileDescription = customerProfile;
parameters.DataLayerID = "US.BlockGroups";
parameters.PCARankSites = 2;
parameters.ProspectingType = esriCustomerProspectingAnalysisType.esriCustomerProspectingPCA;
 
// Set other parameters
imageOptions = null;
outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass };
 
// In general, a non-null esriFolderItem is specified to save a newly-created
// item to the server-side repository or to reference an existing item in it.
outputLayer = new esriFolderItem();
outputLayer.folderType = esriFolderType.esriFolderAnalyses;
outputLayer.itemName = "analysisResult_CustomerProspecting";
outputLayer.projectName = "Default Project";
outputLayer.workspaceName = "Default Workspace";
 
TaskResultOutput result =
    baServerHelper.CustomerProspecting(parameters, imageOptions, outputOptions, outputLayer);

See Also