Geocortex Reporting 5 allows you to better understand and visualize critical relationships in your data through its highly-configurable and versatile reports.
In addition to the wide range of ready-made controls available for you to deploy with this technology, those using or considering the on-premises version of Geocortex Reporting 5 have the added option to use scripting to include attachments in reports.
We explore precisely how this is done in this week’s Geocortex Tech Tip.
Note: this Tech Tip requires using code in the Attachment Script, which can be accessed by clicking here. You’ll need this to try it out for yourself.
“Hi everyone, my name is Houtan Emad and I’m with the technical marketing team. Today I’m going to show you how to use scripting to display feature attachments in Geocortex Reporting 5.
Let’s do this!
The first thing we want to do is make sure we’re using an on-premise version of Reporting 5. The on-premise version, as of 5.1.0 includes the ability to attach scripts to a report.
In this example, we would like to generate reports for specific service requests, where each service request feature may have an image as the feature attachment.
We’ll first set up a basic Web AppBuilder site that consumes a web map which includes our service requests layer. Once that’s set up, we will open up Geocortex Reporting 5 on-premise version 5.1.0, add our service requests layer as a data source, and create a basic layer report using the wizard.
We can add this report to our Web AppBuilder site and target the Service Requests layer.
We’ll save our site and test our report.
Look good! Let’s go back to the report designer.
To include feature attachments in our report, we will drag a PictureBox element into our design area and then switch over to the Scripts section of designer.
Right, now we’re going to copy and paste the standard image attachment script here. You can find a copy of this script in the description. Once added, we will need to make a couple of customizations.
Our first adjustment is on line 2. Here we’re pointing to a “No Image Available” URL which will be displayed when we’ve selected a feature that has no image attachments.
Next, we’ll specify the service URL on line 3. We want to point to our layer containing the feature attachments.
On line 4, we’re targeting the Object ID field which is used in composing a link to the feature attachment.
Finally, on lines 2, 31, and 32 we’re making a reference to the ID of the picture box element we’re targeting in our report. Our example targets pictureBox1. We can validate our script by using the script validation button, and then navigating back to the report design interface.
As the final stage in our set up, we select our picture box element and expand the Behavior section of the Properties tab. Under Scripts, we will use the dropdown options for Before Print and select ‘Detail1_BeforePrint,’ which is the name of the function we just wrote in the scripts section.
We can then save our report and test it again in Web AppBuilder.
That looks good too!
By spending a little more time on the report, we can fully brand it, add additional fields, and even feature maps.
If we wanted to generate a report for more than one Service Request at a time, and provide the user with a more guided interaction, we can leverage Geocortex Workflow 5 in conjunction with Geocortex Reporting 5 to achieve that.”
Discover how Geocortex Reporting can be used alongside Web AppBuilder to enhance and extend your applications. Check out our webinar, Enhancing Web AppBuilder for ArcGIS® with Geocortex Reporting by clicking the button below.