Get Report Templates Info (Server)

Summary

Returns the content of report files and templates in JSON format. Report files (.rptx) and report templates (.rptt) are used to store report definitions.

Usage

  • This tool is intended to be published as a geoprocessing task in a printing service.

  • The output of this tool is a string formatted as JSON. The string is a list of available report templates and report files with the following information:

    • Report section information
      • Report name
      • Report data source
    • Related report section information
      • Relationship ID
      • Related report data source
    • Grouping
    • Field values
    • Field names
    • Statistics

    A sample output JSON:

    [{
        "reportTemplate": "Attribute List Group Letter Landscape",   // name of the template
        "reportOptions": {
          "Report Section": {
            "name": "My Report",                                     // name of the report section
            "sourceId": "my_source",                                 // report section data source
            "groupSections": {                                       // field(s) used for grouping
              "Group Header: [group-field-value]": "Subdivision"
            },
            "fieldElements": {                                       // field(s) used for dynamic field values
              "Field 1": "APN10",
              "Field 2": "Address",
            },
            "fieldLabelElements": {
              "Field Label 1": "Parcel",
              "Field Label 2": "Street Address"
            },
            "statisticElements": {                                   // field(s) used for statistics
              "Count Statistic Field 1": "APN10",
            } } 
        }
      },
        {
          "reportTemplate": "Custom_AttrList_RelatedReport_Port",
          "reportOptions": {
            "Report Section": {
              "name": "States Report",
              "sourceId": "us-states",
              "fieldElements": {
                "Field 1": "Name",
                "Field 2": "Population",
                "Field 3": "Region"
              },
              "fieldLabelElements": {
                "Field Label 1": "State Name",
                "Field Label 2": "Current Population",
                "Field Label 3": "Region"
              },
              "statisticElements": {
                "Count Statistic Field 1": "Name"
              }
            },
            "Related Report Section": {
              "relatedId": "R1L1statesL0cities",                     //related report Id
              "sourceId": "us-cities",                               //related report data source
              "fieldElements": {
                "Related Field 1": "SqMi_Area",
                "Related Field 2": "Population"
              },
              "fieldLabelElements": {
                "Related Field Label 1": "Area",
                "Related Field Label 2": "Population"
              } } 
    } 
    }]
  • Use the same folder location of the associated Export Web Map tool.

  • For more information, see Printing in web applications in the ArcGIS Enterprise help.

Parameters

LabelExplanationData Type
Report Templates Folder
(Optional)

The full path to the folder where the report files (.rptx or .rptt) that will be used as report templates are located. The default location is <install_directory>\Resources\ArcToolBox\Templates\ExportWebMapTemplates.

Folder
Report Item ID
(Optional)

The portal ID (in JSON format) of the report item that will be used for the templates. Use the format {"id": "<portal-id>"}.

String

Derived Output

LabelExplanationData Type
JSON String

A JSON formatted string. The string is a list of available report templates (.rptt) and files (.rptx) with additional information.

String

arcpy.server.GetReportTemplatesInfo({Report_Templates_Folder}, {Report_Item_ID})
NameExplanationData Type
Report_Templates_Folder
(Optional)

The full path to the folder where the report files (.rptx or .rptt) that will be used as report templates are located. The default location is <install_directory>\Resources\ArcToolBox\Templates\ExportWebMapTemplates.

Folder
Report_Item_ID
(Optional)

The portal ID (in JSON format) of the report item that will be used for the templates. Use the format {"id": "<portal-id>"}.

String

Derived Output

NameExplanationData Type
Output_JSON

A JSON formatted string. The string is a list of available report templates (.rptt) and files (.rptx) with additional information.

String

Code sample

GetReportTemplatesInfo example (Python window)

The following script returns a list of metadata for each report.

import arcpy
arcpy.server.GetReportTemplatesInfo(r'C:\Data\MyReports')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics