FRAMES | NO FRAMES |
Creates store or customer records by their postal addresses.
Availability: Business Analyst Server.
TaskResultOutput CreateRecordSetByAddresses ( RecordSetByAddress[] AddressRecords, esriFolderType FolderType );
Parameter | Description |
---|---|
AddressRecords | Array of address records. Type RecordSetByAddress[]. |
FolderType | Records type. Type esriFolderType. |
Variable of type TaskResultOutput whose RecordSet property contains recordswith address attributes. This record set can be used as an input for CustomerStoreSetupByGeocodeTable and ProfileByTableGeocoding methods.
The FolderType parameter specifies the record set type:
The example below creates an address record set of 6 store locations and saves this record set as a persistent store layer in the server-side repository. As this example demonstrates, an instance of the RecordSet type is often used as an input to other Business Analyst Server analysis tasks.
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; // ========= STEP 1: Create a record set by store addresses RecordSetByAddress[] storeAddresses = new RecordSetByAddress[6]; storeAddresses[0] = new RecordSetByAddress(); storeAddresses[0].Name = "pizza1"; storeAddresses[0].Description = "Rush Street Store"; storeAddresses[0].StoreID = "1"; storeAddresses[0].Address = "730 N. Rush St."; storeAddresses[0].City = "Chicago"; storeAddresses[0].State = "IL"; storeAddresses[0].ZIP = "60611"; storeAddresses[1] = new RecordSetByAddress(); storeAddresses[1].Name = "pizza2"; storeAddresses[1].Description = "Clark Street Store"; storeAddresses[1].StoreID = "2"; storeAddresses[1].Address = "2121 N. Clark St."; storeAddresses[1].City = "Chicago"; storeAddresses[1].State = "IL"; storeAddresses[1].ZIP = "60614"; storeAddresses[2] = new RecordSetByAddress(); storeAddresses[2].Name = "pizza3"; storeAddresses[2].Description = "31st Street Store"; storeAddresses[2].StoreID = "3"; storeAddresses[2].Address = "4254 W. 31st St."; storeAddresses[2].City = "Chicago"; storeAddresses[2].State = "IL"; storeAddresses[2].ZIP = "60623"; storeAddresses[3] = new RecordSetByAddress(); storeAddresses[3].Name = "pizza4"; storeAddresses[3].Description = "Wells Street Store"; storeAddresses[3].StoreID = "4"; storeAddresses[3].Address = "439 N. Wells St."; storeAddresses[3].City = "Chicago"; storeAddresses[3].State = "IL"; storeAddresses[3].ZIP = "60610"; storeAddresses[4] = new RecordSetByAddress(); storeAddresses[4].Name = "pizza5"; storeAddresses[4].Description = "Ohio Street Store"; storeAddresses[4].StoreID = "5"; storeAddresses[4].Address = "29 E. Ohio St."; storeAddresses[4].City = "Chicago"; storeAddresses[4].State = "IL"; storeAddresses[4].ZIP = "60611"; storeAddresses[5] = new RecordSetByAddress(); storeAddresses[5].Name = "pizza6"; storeAddresses[5].Description = "North Avenue Store"; storeAddresses[5].StoreID = "6"; storeAddresses[5].Address = "1927 North Ave."; storeAddresses[5].City = "Chicago"; storeAddresses[5].State = "IL"; storeAddresses[5].ZIP = "60622"; TaskResultOutput recordSetResult = baServerHelper.CreateRecordSetByAddresses(storeAddresses, esriFolderType.esriFolderStoreLayers); // Create a store layer from the address record set TableData tableData = new TableData(); tableData.RecordSet = recordSetResult.RecordSet; GeocodeData geocodeData = new GeocodeData(); geocodeData.Table = tableData; // ========= STEP 2: Geocode the record set with stores CustomerStoreSetupByGeocodeTableParameters geocodeParameters = new CustomerStoreSetupByGeocodeTableParameters(); // Set specific analysis parameters geocodeParameters.GeocodeCustomers = false; geocodeParameters.GeocodeData = geocodeData; geocodeParameters.NameField = "NAME"; geocodeParameters.StoreIDField = "STORE_ID"; // 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.esriFolderStoreLayers; outputLayer.itemName = "storeLayer_CreateRecordSetByAddresses"; outputLayer.workspaceName = "Default Workspace"; outputLayer.projectName = "Default Project"; TaskResultOutput result = baServerHelper.CustomerStoreSetupByGeocodeTable(geocodeParameters, imageOptions, outputOptions, outputLayer); |