Touchstone Re 2023 API Reference
SubmitImportCsvWithAutomap Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > DataImportServiceClient Class : SubmitImportCsvWithAutomap Method
Contains a SubmitImportCsvWithAutomapRequest that identifies the Business Unit SID and SQL Instance SID to associate with the CSV file(s) to import. The request contains the Import Options and Mapping Options objects that enable you to configure the import job.
Imports data in comma-separated values (CSV) format into Touchstone® and automatically maps the column headers in the CSV files to standard Touchstone fields.

You can create user-supplied geocode match level codes using the MappingSetID and UserGeocodeMatchMappingSet properties defined in the ImportOptionsCsv class when importing exposure data into Touchstone.

When you call the SubmitImportCsvWithAutomap() method, the application:

  1. Normalizes the column names in the files to import.
  2. Excludes any column names that you indicate should be excluded from the automapping process.
  3. Attempts to locate an existing mapping set that includes all the non-excluded normalized column names.
  4. Creates a new mapping set if it cannot find a match.
  5. Uses the new or existing mapping set to automatically map the column headers in the files to standard Touchstone fields.

A CSV file is a plain text file that contains spreadsheet or database data. A comma or similar delimiter separates fields within a record. Each record begins on a new line.

Currently, you can apply the automapping feature only to Primary Property data.

Syntax
Public Function SubmitImportCsvWithAutomap( _
   ByVal request As SubmitImportCsvWithAutomapRequest _
) As SubmitImportCsvWithAutomapResponse
Dim instance As DataImportServiceClient
Dim request As SubmitImportCsvWithAutomapRequest
Dim value As SubmitImportCsvWithAutomapResponse
 
value = instance.SubmitImportCsvWithAutomap(request)

Parameters

request
Contains a SubmitImportCsvWithAutomapRequest that identifies the Business Unit SID and SQL Instance SID to associate with the CSV file(s) to import. The request contains the Import Options and Mapping Options objects that enable you to configure the import job.

Return Value

A SubmitImportCsvWithAutomapResponse that contains the Activity SID which uniquely identifies the asynchronous web service call that you made to initiate the import job.
Remarks

AIR strongly recommends that the CSV file does not contain more than one space between words, commas, letters with accents, currency symbols or the following special characters: ?©•#/<>‐&°()+:;'!"

To find the Business Unit SID to pass into this method, call the GetBusinessUnits() method.

To find the SQL Instance SID to pass into this method, call the GetSqlInstances() method.

Example
The following example shows how to import CSV data into Touchstone and enable the auto-mapping feature using the SubmitImportCsvWithAutomap() method:
using AIR.Services.Common.Data;
 using AIR.Services.Common.Exposure.Data;
 using AIR.Services.DataImport.Api;
 using AIR.Services.DataImport.Data;
 using AIR.Services.DataImport.MappingSetManagement.Data;
 using System;
 using System.Collections.Generic;
            
 public class SnippetSubmitImportCsvWithAutomapRequest
 {
 private static void ImportExpressCSVAutomap(int businessUnitSid, int sqlInstanceSid, int dataSourceSid, int exposureSetSid, int mappingSetSid,
    string contractsFilePath, string locationsFilePath)
 {
            
 DataImportServiceClient importClient = new DataImportServiceClient();
 SubmitImportCsvWithAutomapRequest request = new SubmitImportCsvWithAutomapRequest();
    request.BusinessUnitSid = businessUnitSid;
        request.SqlInstanceSid = sqlInstanceSid;
        request.ImportOptions = new ImportOptionsCsv()
        {
            Currency = "USD",
            CurrencyExchangeRateSid = 3,
            DataSourceSid = dataSourceSid,
            ExposureSetSid = exposureSetSid,
            ContractsFilePath = contractsFilePath,
            LocationsFilePath = locationsFilePath,
            DateTimeFormat = "MM/DD/YYYY",
            HasHeaders = true,
            Delimiter = ',',
            TextQualifier = TextQualifier.DoubleQuote,
            DuplicateContractBehaviour = DuplicateContractsOption.Replace,
            Geocoder = BaseGeocoder.AIRGeocoder,
            PreserveGeocode = true,
            VerifyOnly = false,
            
        };
            
        request.MappingOptions = new FilesMatchingMappingSetOptions()
        {
            ContractExcludedColumnNames = new List<string>()
                {
                    "UserDefined Field 1 (UDF 1)",
                    "UserDefined Field 2 (UDF 2)",
                    "UserDefined Field 3 (UDF 3)",
                    "UserDefined Field 4 (UDF 4)",
                    "UserDefined Field 5 (UDF 5)"
                },
            ContractType = ContractType.PrimaryProperty,
            DefaultsXML = null,
            Delimiter = ',',
            FailedOnUnmappedColumns = false,
            LocationExcludedColumnNames = new List<string>()
                {
                    "ConstructionCodeType",
                    "OccupancyCodeType"
                },
            MappingSetName = "AutoMappingSet - " + new Random().Next(),
            ReinsuranceExcludedColumnNames = new List<string>(),
            StepFuctionExcludedColumnNames = new List<string>(),
            TextQualifier = TextQualifier.DoubleQuote
        };
        SubmitImportCsvWithAutomapResponse response = importClient.SubmitImportCsvWithAutomap(request);
        if ((response.Status.Code == StatusCode.Success))
        {
            Console.WriteLine("Submitted Successfully to HPC with Activity SID: " + response.ActivitySid);
        }
    }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

DataImportServiceClient Class
DataImportServiceClient Members