Touchstone 11.0 API Reference
SubmitImportCsv Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > DataImportServiceClient Class : SubmitImportCsv Method
Contains a SubmitImportCsvRequest that identifies the Import Options associated with the CSV file(s) that you want to import, along with the associated Business Unit SID and SQL Instance SID.
Imports data in comma-separated values (CSV) format into Touchstone®.

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.

A CSV file is a plain text file that contains spreadsheet or database data. A comma separates fields within a record. Each record begins on a new line. CSV format enables you to transfer large quantities of data between programs without worrying about special file types.

Syntax
Public Function SubmitImportCsv( _
   ByVal request As SubmitImportCsvRequest _
) As SubmitImportCsvResponse
Dim instance As DataImportServiceClient
Dim request As SubmitImportCsvRequest
Dim value As SubmitImportCsvResponse
 
value = instance.SubmitImportCsv(request)

Parameters

request
Contains a SubmitImportCsvRequest that identifies the Import Options associated with the CSV file(s) that you want to import, along with the associated Business Unit SID and SQL Instance SID.

Return Value

A SubmitImportCsvResponse containing the Activity SID that uniquely identifies the asynchronous web service call that you made to import the specified CSV file(s).
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 using the SubmitImportCsv() method:
using System;
using AIR.Services.Common.Data;
using AIR.Services.DataImport.Api;
using AIR.Services.DataImport.Data;
            
class SnippetSubmitImportCsvRequest
{
    private static void ImportExpressCSV(int businessUnitSid, int sqlInstanceSid, int dataSourceSid, int exposureSetSid, int mappingSetSid,
        string contractsFilePath, string locationsFilePath)
    {
        DataImportServiceClient importClient = new DataImportServiceClient();
        SubmitImportCsvRequest request = new SubmitImportCsvRequest();
        request.BusinessUnitSid = businessUnitSid;
        request.SqlInstanceSid = sqlInstanceSid;
        request.ImportOptions = new ImportOptionsCsv()
        {
            Currency = "USD",
            CurrencyExchangeRateSid = 1,
            DataSourceSid = dataSourceSid,
            ExposureSetSid = exposureSetSid,
            MappingSetSid = mappingSetSid,
            ContractsFilePath = contractsFilePath,
            LocationsFilePath = locationsFilePath,
            DateTimeFormat = "MM/DD/YYYY",
            HasHeaders = true,
            Delimiter = ',',
            TextQualifier = AIR.Services.DataImport.Data.TextQualifier.DoubleQuote,
            DuplicateContractBehaviour = DuplicateContractsOption.Replace,
            Geocoder = BaseGeocoder.AIRGeocoder,
            PreserveGeocode = true,
            VerifyOnly = false
        };
        AIR.Services.DataImport.Api.SubmitImportCsvResponse response = importClient.SubmitImportCsv(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