Use an inline frame (iframe) to embed a page from which a report can be generated, in your custom web app.
Prerequisites
The following steps require you to already have a survey published and an report template uploaded. If you do not already have a survey see Create and publish a survey. For detailed guidance on report templates and generating reports directly through the Survey123 website, see Report templates.
Steps
-
To configure the required URL parameters for the report page, start with the URL https://survey123.arcgis.com/featureReport, then add the following required parameters:
- surveyItemId - The survey item ID for which you are generating a report. This provides the context for the survey questions in the report.
- featureLayerUrl - The source feature layer or the result feature layer view of the survey. This is where the data to populate the report comes from. The value should look like https://services1.arcgis.com/oC086ufSSQ6Avnw2/arcgis/rest/services/serviceName/FeatureServer/0.
- queryParameters - A JSON string whose value will be passed to the query operation to filter data as input features for the report.
To put these together, your report page URL should look similar to this:
Use dark colors for code blocks Copy https://survey123.arcgis.com/featureReport?surveyItemId=<surveyId>&featureLayerUrl=<feature layer URL>&queryParameters={"where": "STATUS = 'broken'","orderByFields":"inspectionDate DESC","resultRecordCount":10}
To quickly generate the report URL with your current settings, go to the Data tab of the Survey123 website, click the Report link button under the Report panel to open a dialog that provides the URL to embed your current report settings in a web page.
-
In your custom web app, create an iframe element and add HTML that represents the report page.
Parameters
When you embed a report page in either ArcGIS Dashborads or your custom web app, you can add parameters to control the way the report page is displayed.
The following example displays the report page in the embed element in ArcGIS Dashboards, which allows you to generate a report for the selected features:
https://survey123.arcgis.com/featureReport?featureLayerUrl=https://services1.arcgis.com/oC086ufSSQ6Avn00/arcgis/rest/services/<service name>/FeatureServer/0&queryParameters=%7B%22objectIds%22%3A%22{field/objectid}%22%7D&inputFeatureTemplate=Feature%20%7Bobjectid%7D%3A%20%7Buntitled_question_1%7D&surveyItemId=<surveyId>
Available parameters are listed in the following table:
Parameter | Required | Description | Example |
---|---|---|---|
survey | Yes | The survey item ID you generate a report for. This provides the report context of survey questions. | survey |
feature | Yes | The source feature layer or the result feature layer view of the survey. This is where the data comes from to populate the report. | feature . |
query | Yes | This is the same parameter used in the report REST API, a JSON string whose value will be passed to the query operation to filter data as input features for the report. where , object , order , and result are supported. | For example, in a hydrant inspection layer, {"where" will send the latest 10 hydrant features in broken status to the report. |
portal | No | Specifies the URL to the portal where the survey and feature layer item is hosted. For instance, when connecting to your ArcGIS Enterprise. | portal |
client | No | The Client ID when registering the app (parent page) in ArcGIS Online. Ignore this parameter if you are embedding the page into ArcGIS apps (e.g., ArcGIS Dashboards). | client |
show | No | Comma-separated array. Only the elements specified in this list will be shown. Supported elements: input , select , file , report , save , output , show , recent , navbar . The "Output settings" section title shows up when any of the following shows: file , report , save , output . | show=navbar,input |
hide | No | Comma-separated array. All elements except those specified in this list will be shown. Supported elements are the same as with the show parameter. | hide=navbar,input |
input | No | Defines how a feature displays in the “Input features” section. Use { to refer to an attribute value. | For example, input -> Hydrant 1245, Status |
report | No | A comma-separated string for report template item IDs. If present, the report template dropdown list only shows templates specified in this list. Otherwise, the dropdown list shows all templates related to the survey. | report |
label | No | A JSON string to overwrite text labels for each element. | label={"input |
page | No | Specifies the title of this page. | page |
What's next?
Automate the creation of a richly formatted printable report from survey responses using the REST API reference.