FRAMES | NO FRAMES
GetReport Method

Generates a report in the given format from a report item previously created and stored in the repository and returns a URL to the report generated.

Availability: Business Analyst Server.

TaskResultOutput GetReport ( 
    esriFolderItem    ReportItem, 
    string            SubreportName, 
    esriReportFormat  ReportFormat,
    string[]          ReportFormats
);

Parameter Description
ReportItem The report item stored in the repository. Type esriFolderItem.
SubreportName Subreport name. Type String. This parameter is deprecated.
ReportFormat This parameter should be null. This parameter is deprecated.
ReportFormats Array of output report formats. Type String[]. Available with Business Analyst Server 10.0.

Returns

Variable of type TaskResultOutput whose Reports array contains ReportInfo items.

Remarks

Since Business Analyst Server 10.0, a report in the repository doesn't contain subreports and the ReportFormat parameter for this task is replaced with the ReportFormats parameter which is a array of output formats to get a report in. The result of this task is also changed from String to TaskResultOutput type.

Examples

The example below generates a report of the specified formats from an existing report in the Business Analyst Server Repository. In order to demonstrate this method, a couple of reports are created and saved to the repository. The GetReport method is then used to retrieve the reports in different formats.

NOTE: The signature of the BAServerHelper.GetReport method is simplified against this method—deprecated parameters are removed and the ReportFormats parameter is specified with the params keyword allowing users to pass output formats in the variable-length list of parameters.

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
 
// You can specify below a domain of your local Business Analyst Server.
//baServerHelper.BAServerDomain = "esri.com";
 
// If a domain name is specified, a local server name in output URLs is replaced with the
// fully-addressable server name so people and machines outside the domain of your local
// Business Analyst Server instance can access these URLs.
 
// Create a PointRecord array containing a single store location (center of study/trade areas)
PointRecord[] storePoints = new PointRecord[1];
 
storePoints[0] = new PointRecord();
storePoints[0].Name = "store_study_site";
storePoints[0].Description = "Store Study Site";
storePoints[0].StoreID = "1";
storePoints[0].Latitude = 34.057596;
storePoints[0].Longitude = -117.195683;
 
// Create a store feature layer based on an array of point records
PointLayer storeLayer = new PointLayer();
storeLayer.Points = storePoints;
 
SimpleRingsParameters parameters = new SimpleRingsParameters();
 
// Set specific analysis parameters
parameters.DistanceUnits = esriUnits.esriMiles;
parameters.Radii = new double[] { 1, 2, 3 };
parameters.SingleStoreID = "1";
parameters.Stores = storeLayer;
 
// StoreIDField is useless for stores specified with array of PointRecord
//parameters.StoreIDField = "STORE_ID";
 
// Set summary report parameters - two summary reports will be created
ReportOptions ageSexReport = new ReportOptions();
ageSexReport.ReportFormat = "PDF";
ageSexReport.TemplateName = "Age by Sex Profile";
 
ReportOptions demoReport = new ReportOptions();
demoReport.ReportFormat = "PDF";
demoReport.TemplateName = "Demographic and Income Report";
parameters.ReportOptions = new ReportOptions[] { ageSexReport, demoReport };
 
// Set other parameters
RenderingParameters imageOptions = null;
TaskOutputType[] outputOptions = new TaskOutputType[] { TaskOutputType.GetFeatureClass, TaskOutputType.GetReport };
esriFolderItem outputLayer = null;
 
// 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.
esriFolderItem outputReport1 = new esriFolderItem();
outputReport1.folderType = esriFolderType.esriFolderReports;
outputReport1.itemName = "reports_GetReport1";
outputReport1.projectName = "Default Project";
outputReport1.workspaceName = "Default Workspace";
 
esriFolderItem outputReport2 = new esriFolderItem();
outputReport2.folderType = esriFolderType.esriFolderReports;
outputReport2.itemName = "reports_GetReport2";
outputReport2.projectName = "Default Project";
outputReport2.workspaceName = "Default Workspace";
 
TaskResultOutput result =
    baServerHelper.SimpleRings(parameters, imageOptions, outputOptions, outputLayer, outputReport1, outputReport2);
 
// Now, the original esriFolderItem reference will be used to access the two reports.
// We get reports in other formats that were used in parameters of the SimpleRings method
TaskResultOutput report1 = baServerHelper.GetReport(outputReport1, "HTML", "PDF");
TaskResultOutput report2 = baServerHelper.GetReport(outputReport2, "S.XML", "XLSX");

See Also