The Related Records Table widget allows you to embed a table of data from an ArcGIS feature service into your report, either by following the relationships defined in your master feature service or by using a geographical query.
Using Relationships
Relationships in ArcGIS Server/Online allow you to query data from one table or service based on a relationship defined in your source or master service. So, for example, by using relationships you can specify that your Wards service is related to your Districts service based on a lookup in a field in your Wards. Or you could have a relationship going the other way – for your Districts service you could use relationships to link to all the Schools that lie within each district feature. Report Builder can use these relationships to query data and embed it in your report. An InstantAtlas Data Catalog also makes use of these relationships to make it easy for you to use comparison data in your reports.
Using a Geographical Query
If your feature services do not have explicit relationships defined, the Related Records Table widget can also find related records from another feature service using a geographical query – for example, “find all schools that lie within this district”.
This page describes specific settings for the Related Records Table widget. Note that generic widget settings are described on the Widget Generic Settings page, so if you cannot find the setting you are looking for check there too.
Records – Query & Lookups
Mode
Set the mode for the query.
Query relationships
Optionally, you can use this to define which relationships to use. For example, if your master layer has multiple related tables, you can enter a comma-delimited list of the ID(s) of the relationship(s) that you wish to use e.g. 0,1,2. This setting is only active if the Mode setting is set to relationship.
Query Layer
Enter the URL for the query layer. This setting is only active if the Mode setting is set to geographic.
Sub query (filter)
Optionally, enter a query string to further filter the relationship query.
Spatial/geographic query type
Choose the type of geographic query you wish to use. For example, choose within to only return features in the query layer that are completely within the selected feature for the report. This setting is only active if the Mode setting is set to geographic.
Spatial/geographic query distance (m)
Set a buffer distance in meters to apply to the geographic query.
Query fields
A comma-delimited list of field names that controls the fields that will be extracted from the target feature layer. Unless the target layer has a very large number of fields, you can leave this as * (which means “all fields”).
Display fields
A comma-delimited list of field names that controls which of the Query Fields are shown in the results table. Again, * will show all fields.
Distinct values only
If this setting is set to toggled on, and the query would return a particular value multiple times, it will only be displayed once rather than repeating over and over.
Custom query parameters (json)
Use this setting to add custom parameters to your query. This setting is only active if the Mode setting is set to geographic.
Records – Display & Layout
Layout mode
The default behavior of this widget is to show the results as a simple table. The widget can also be configured to show more complex results by setting Layout mode to custom.
Table layout
Set the preferred layout for the table. This setting is only active if the Layout mode setting is set to table.
Cell data format
Set the text that will be inserted into each cell. #VAL will be replaced with the value from the field. If you need to add units or similar you can just adjust this, for example #VAL metres. If the Layout mode setting is set to custom, this setting must contain both the HTML and the variables that will be replaced with data values, for example:
<div class="ia-text-box-widget static ">…<div class="ia-text-box-title" style="padding: 5px; font-weight: normal;">Site ID: $feature.SITE_NO</div>…<div style="flex: 1 0; width: 25%;">Name:</div><div style="flex: 1 1;">$feature.NAME</div></div> <div style="display: flex;"><div style="flex: 1 0; width: 25%;">Easting:</div><div style="flex: 1 1;">$feature.EAST</div>…</div>
The variables can be specified either using Report Builder substitution variables or as Arcade-style variables – so $feature.SITE_NO means “the value of the field SITE_NO for the current feature”. This Cell Data Format will then be applied in turn to each feature that matches the query.
Custom format – opening tag
The opening tag if the Layout Mode setting is set to custom, for example
<div style="color:#333333;">
Custom format – closing tag
The closing tag if the Layout mode setting is set to custom, for example
</div>