Touchstone 11.0 API Reference
SubmitLossAnalysisExport Method
Example 


Air.Services.Proxy Assembly > (Global) Namespace > DataExportServiceClient Class : SubmitLossAnalysisExport Method
Contains a SubmitLossAnalysisExportRequest that identifies the Export Options associated with the Detailed Loss Analysis results that you want to export, along with the associated Business Unit SID and SQL Instance SID.

Note: To export Detailed Loss Analysis results, you must specify the report templates (identified by codes) that Touchstone should use for the export, for example, Event Loss by Portfolio, Event Loss by Line of Business (LOB), Average Annual Loss by Contract, etc. If you want to export all the reports, use the GetLossAnalysisExportTemplates() method to get all available templates.

Submits a request to export Touchstone® Detailed Loss Analysis results to a comma separated values (CSV) file.
Syntax
Public Function SubmitLossAnalysisExport( _
   ByVal request As SubmitLossAnalysisExportRequest _
) As SubmitLossAnalysisExportResponse
Dim instance As DataExportServiceClient
Dim request As SubmitLossAnalysisExportRequest
Dim value As SubmitLossAnalysisExportResponse
 
value = instance.SubmitLossAnalysisExport(request)

Parameters

request
Contains a SubmitLossAnalysisExportRequest that identifies the Export Options associated with the Detailed Loss Analysis results that you want to export, along with the associated Business Unit SID and SQL Instance SID.

Note: To export Detailed Loss Analysis results, you must specify the report templates (identified by codes) that Touchstone should use for the export, for example, Event Loss by Portfolio, Event Loss by Line of Business (LOB), Average Annual Loss by Contract, etc. If you want to export all the reports, use the GetLossAnalysisExportTemplates() method to get all available templates.

Return Value

A SubmitLossAnalysisExportResponse containing the Activity SID that uniquely identifies the asynchronous web service call that you made to submit the specified Detailed Loss Analysis results export request.
Remarks
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.

For information about submitting a new Touchstone Detailed Loss Analysis job, see the SubmitDetailedLossAnalysis() method.

Example
The following example shows how to submit a request to export Touchstone Detailed Loss Analysis results to a CSV file using the SubmitLossAnalysisExport() method:
using System;
 using System.Collections.Generic;
 using AIR.Services.Common.Data;
 using AIR.Services.Common.Filter.Data;
 using AIR.Services.DataExport.Api;
            
class SnippetSubmitLossAnalysisExportRequest
{
    private static void ExportLossAnalysisResults(int businessUnitSid, int sqlInstanceSid, int projectSid, int analysisSid,
                        string exportFolder, string exportFileName, string exportActivityName)
    {
        DataExportServiceClient client = new DataExportServiceClient();
        GetLossAnalysisExportTemplatesRequest request = new GetLossAnalysisExportTemplatesRequest();
        request.BusinessUnitSid = businessUnitSid;
        request.SqlInstanceSid = sqlInstanceSid;
        request.AnalysisSid = analysisSid;
            
        GetLossAnalysisExportTemplatesResponse response = client.GetLossAnalysisExportTemplates(request);
        if (response.Status.Code == StatusCode.Success)
        {
            SubmitLossAnalysisExportRequest exportRequest = new SubmitLossAnalysisExportRequest();
            exportRequest.BusinessUnitSid = businessUnitSid;
            exportRequest.SqlInstanceSid = sqlInstanceSid;
            exportRequest.ExportOptions = new AIR.Services.DataExport.Data.LossAnalysisExportOptions()
            {
                AnalysisSid = analysisSid,
                Filters = GetCompositeExportFilter(),
                FinancialPerspectives = AIR.Services.Common.Data.FinancialPerspectives.Gross,
                DestinationFolder = exportFolder,
                DestinationFileName = exportFileName,
                ProjectSid = projectSid,
                ActivityName = exportActivityName,
                TemplateCodes = response.TemplateCodes
            };
            
            SubmitLossAnalysisExportResponse exportResponse = client.SubmitLossAnalysisExport(exportRequest);
            if (exportResponse.Status.Code == StatusCode.Success)
                Console.WriteLine("Submitted Successfully to HPC with Activity ID: " + exportResponse.ActivitySid);
        }
            
    }
            
    private static List<Filter> GetSimpleExportFilter()
    {
        //None = 0, Peril = 1, Geography = 2, Construction = 3, Occupancy = 4, UserLineOfBusiness = 5
        Filter filterPerils = new Filter()
        {
            ID = 1, //Peril
            Expression = new SimpleExpression()
            {
                AppliedEntity = "LossByEvents",
                PropertyName = "Perils",
                Operator = FilterOperator.IsContainedIn,
                Value = new List<int>() { (int)PerilSetCode.WinterStorm, (int)PerilSetCode.SevereThunderstorm }
            }
        };
            
        List<Filter> filters = new List<Filter>();
        filters.Add(filterPerils);
        return filters;
    }
            
    private static List<Filter> GetCompositeExportFilter()
    {
        //None = 0, Peril = 1, Geography = 2, Construction = 3, Occupancy = 4, UserLineOfBusiness = 5
        Filter compositeGeographyFilter = new Filter()
        {
            ID = 2, //Geography
            Expression = new CompositeExpression()
            {
                LogicalOperator = LogicalOperator.And,
                FilterExpressions = new List<FilterExpression>() 
                                            { 
                                                new SimpleExpression()
                                                {
                                                    AppliedEntity = "Geographies",
                                                    PropertyName = "AreaCode",
                                                    Operator = FilterOperator.IsContainedIn,
                                                    Value = new List<string>() { "MA", "TX" }
                                                },
                                                new SimpleExpression()
                                                {
                                                    AppliedEntity = "Geographies",
                                                    PropertyName = "PostalCode",
                                                    Operator = FilterOperator.IsContainedIn,
                                                    Value = new List<string>() { "02112", "01702", "01770" }
                                                }
                                            }
            }
        };
            
        List<Filter> filters = new List<Filter>();
        filters.Add(compositeGeographyFilter);
        return filters;
    }
}
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

DataExportServiceClient Class
DataExportServiceClient Members