Implementing Arcade Expressions in Geocortex Essentials

Implementing Arcade Expressions in Geocortex Essentials [Geocortex Tech Tip]

Jonathan Bystedt
Jonathan Bystedt
Software Developer
October 18, 2019

Implementing Arcade Expressions in Geocortex Essentials [Geocortex Tech Tip]

Implementing Arcade Expressions in Geocortex Essentials

Did you know that Geocortex Essentials now supports the Arcade scripting engine?

The Arcade expression language adds powerful scripting capabilities to the ArcGIS platform. By writing simple scripts, users can manipulate their map data on the fly in several ways. It’s now easier than ever to build a mapping application that pulls data from various sources and uses it creatively to improve decision making!

In this Geocortex Tech Tip, we’ll show you how to use an Arcade script to set up a range of simple to complex scripts that interact with mapping data, as well as how to execute those scripts in various different environments!

Watch on YouTube.

Video Transcript:

“Hi, my name is Jonathan. I’m the Lead Developer on the Geocortex Viewer for HTML5, and today I’d like to show you how you can use Esri’s new Arcade scripting language in your feature details templates in Essentials and GVH. Let’s get started!

Alright, so today we’re going to be talking about Arcade expressions.

Arcade is a scripting language that has been developed by Esri in order to allow people to write simple to complex scripts that interact with mapping data and execute those scripts in various different environments, on the web, up in your Esri API-based application, etc. The same script can be safely run in of these different places and it allows you to do a lot of things that either required custom code before or require you to do some complex set up in your data beforehand. This’ll probably all make sense if I show you some examples, so let’s dive in!

First of all, you should go to developers.arcgis.com/arcade for more in-depth information on this. There is a great guide here, it goes through every feature that’s available.

One thing I will touch on right now is that if you go to the guide, it will start giving you some very simple examples of Arcade script and it will talk about profiles. The profile that we use in GVH is very similar to the pop-up profile because we’re targeting a very similar use case where were displaying data here in map tips and future details which is very similar to the pop-up that you might see in ArcGIS Online. We’ve implemented all of these global variables, except for the data store.

Basically, what that means is you can access any layer that’s in your map, but if the layer is just in the service and not actually included in the map, we haven’t implemented this so you are not going to be able to access that layer, but everything else is available!

If we go to my copy of the LA County sample site, we will see I’m editing layer census tracts and there is a new tab here called ‘Arcade Expressions.’ If I go to this tab, can see I have some things, some of them are simple and some of them are quite complicated. Let’s take a look. I’ll edit this one, which is one of the simpler ones and this is calculating the area of a polygon. You can see here that I’ve got the global variable for the feature which is just whatever feature we’re operating on right now and I can call the Arcade function area that feature and say that I want a result in square kilometers. Then I can round that result to two decimal places and I can do this all on one line – I don’t have to write a big fancy script with a return statement, I can just have a one-liner just like that, very simple. That is configured with a replacement token that we will then use in the feature details configuration a little bit later on.

I’ll show you something that’s slightly more complex. Here is the calculation for the population density.  We’re going to take the total population and we’re going to divide that by the area and then we’re going to take that around it to two decimal places because we don’t want a big ugly number, two decimal places is fine.

Moving up in complexity – here’s something that queries other data in the map that isn’t actually included in the feature that we are looking at right now. What we’re going to do here, is we’re going to find out the larger community that the census tract is within.

First, we’ll un this Arcade expression called a ‘FeatureSetByID,’ pass it the map variable, and we will pass it the ID of the map service that we want to look at. This has to be a feature layer, and then at the field that we want to return, and then I will get a feature set containing all of the communities on the map, and we will download the name field for each one will leave the other data on the server.

I will assign that the community’s variable (the syntax here is very much like JavaScript if you’re at all familiar with that). We’ll then find the first one that intersects our feature from that data set and if it’s not empty, if we got a result, we’ll return the name of that result otherwise we’ll just return unknown.

The most complicated one here, just to show you know this sky is really the limit you can have multiple functions and loops and a lot of different things going on. What this is doing is it’s going to — very quickly — it’s going to query a layer for intersecting items and the layer is a layer of communications facilities. Then it’s going to sort those by type and it’s going to take the top five by type because I’ve made it a little function called ‘topX,’ which takes a type category and the ID of a map service and a number of results that you want to return, and it will return the top five types of communication facilities located within that census tract, and this is all done on the fly, and is something that no longer requires either custom code or setting up your data beforehand. You can just do it on the fly in the viewer!

Let’s see what that looks like – here’s the LA County sample site. I’ll just Identify some features here, so we can get some census tracts and we’ll have a look at those census tracts. I’br got quite a few here so it’s going to take a little bit to load up and there we go.

I should mention that if you’re carrying another layer, that makes your result asynchronous, so if you’re doing a complex query with a lot of operations or you have simply a large collection of features, it may take some time for that sync operation to resolve.

Here we can see the results of the community or in the wholesale community here, which is kind of the warehousing area on the east side of Los Angeles. We can see that the population which we just grab from the feature, the area which we calculated on the fly, and the population density which we also calculated on the fly. And then we have the top five. Now, we didn’t actually have five separate types of communications infrastructure in the census tract, so it only returned three results and just gave us a little short little report on those things in our feature details, which would also show up in a map tip, if you had a map tip, the same way that feature details regularly works.

I should actually show you the configuration of that. The feature description here looks like that and you can see that your Arcade expressions now show up as replacement tokens that you can add here.

I’ll quickly show you a few more that have been configured here. Let’s take a look at ‘Service Requests’ – this is a little bit of a different one. Here we’ve actually queried for the attachments and we’ve taken those attachments and added them as clickable links directly to the feature descriptions. I can just click on one of the attachments here and view it just like that, right from the feature details or the map tip. That’s because there is an attachments method in Arcade that you can run that will query the server and bring you back information about the attachments on that feature.

Another one – let’s have a look at highways and major roads. Here road class that comes straight from the feature class but passing through a list of all the communities that this particular road passes through and that’s done again by querying the community’s layer, and seeing which features intersect with the linear future. Then we remove duplicates and sort them alphabetically, and that’s all done in the Arcade expression on the fly.

You can see this is very powerful; from very simple things like rounding a number up to more complicated things like determining a population density number or converting degrees Celsius to degrees Fahrenheit, anything like that can be done with Arcade expressions, the sky is really the limit.

These examples are now included in the LA County sample sites. We will be posting up examples of some of the more complex ones that have been included and these have been constructed in such a way that you can just insert the details of your own data and run these on your site pretty much as is. Look for that on our support site soon!

Looking forward to seeing what you guys do with this new feature!

Thanks very much for listening!”

Want to learn more about Geocortex Essentials? Click the button below to dive deeper into the product, or to schedule a personal demonstration.

Discover Geocortex Essentials


Categories:
Archive
Open: 2019
2019
November 1, 2019

How to reference symbology from web maps [Geocortex Tech Tip]

October 25, 2019

How Geocortex Mobile can integrate with other apps [Geocortex Tech Tip]

October 18, 2019

Implementing Arcade Expressions in Geocortex Essentials [Geocortex Tech Tip]

October 17, 2019

Customer Spotlight: Geocortex Mobile

October 11, 2019

How to Format Your Reports [Geocortex Tech Tip]

October 4, 2019

Showing an image in a form after a file picker [Geocortex Tech Tip]

October 2, 2019

Richard Wiegmann Joins VertiGIS as President and CEO

September 27, 2019

Understanding the toolbar in Geocortex Web [Geocortex Tech Tip]

September 20, 2019

Refining Results in Geocortex Web [Geocortex Tech Tip]

September 19, 2019

Charting data using Geocortex Reporting: Honing your charting skills

September 13, 2019

Utilizing the flexibility of layout in Geocortex Web [Geocortex Tech Tip]

September 6, 2019

Creating Geocortex Web applications that move seamlessly between 2D and 3D [Geocortex Tech Tip]

August 28, 2019

Geocortex adds support for Arcade scripting and ArcGIS Online smart mapping

August 23, 2019

How to create sections and groups for your reports [Geocortex Tech Tip]

August 16, 2019

Displaying SQL Server Data in Geocortex Workflow [Geocortex Tech Tip]

August 14, 2019

Customer Spotlight: Geocortex Essentials

August 8, 2019

City of Austin: Spreading floodplain awareness with Geocortex

August 1, 2019

Geocortex Essentials 4.12: Improved integration with ArcGIS® Online

July 25, 2019

Introduction to Geocortex Printing: Learn to build stunning print templates

July 17, 2019

Updates to the Geocortex Product Life Cycle

July 8, 2019

Extending Web AppBuilder for ArcGIS® with Geocortex Essentials [Webinar]

July 4, 2019

City of Bellingham: Using Geocortex to take the stress out of water shut-off

June 27, 2019

Geocortex at the 2019 Esri User Conference

June 14, 2019

Customer Spotlight: Geocortex Workflow

May 17, 2019

Important Notice - Outage Issues & New Support Cases

May 17, 2019

How to build a summary report with aggregations of feature data [Geocortex Tech Tip]

May 16, 2019

Technology Q&A: Geocortex Mobile

May 10, 2019

How to create print templates for Web AppBuilder for ArcGIS®[Geocortex Tech Tip]

May 8, 2019

Dive into Geocortex Printing [Webinar]

May 3, 2019

Using Geocortex Workflow and Geocortex Reporting to produce a multi-layer report [Geocortex Tech Tip]

May 1, 2019

Market-Leading GIS Software and Services Companies Join to Form VertiGIS

May 1, 2019

Introducing VertiGIS

April 18, 2019

Integrating Workflows into Geocortex Mobile [Geocortex Tech Tip]

April 17, 2019

Customer Spotlight: Geocortex Reporting

April 12, 2019

Using Geocortex Go to preview app configurations [Geocortex Tech Tip]

April 10, 2019

How to Address Complex Form Navigation Using Geocortex Workflow

April 5, 2019

Building native, offline IOS, Android and Windows apps with Geocortex Mobile Viewer [Geocortex Tech Tip]

April 3, 2019

Streamlining mobile operations with Geocortex Mobile Viewer [Webinar]

March 29, 2019

A better way to run geoprocessing tasks in Web AppBuilder for ArcGIS [Geocortex Tech Tip]

March 28, 2019

Extend the reach and capabilities of your applications with integrations [eBook]

March 22, 2019

Displaying data from SQL Database when you select features [Geocortex Tech Tip]

March 20, 2019

How Geocortex users are enriching the communities they serve

March 15, 2019

How to Configure a Geocortex Essentials layer report with Geocortex Reporting 5 [Geocortex Tech Tip]

March 14, 2019

Region of Waterloo: How GIS & Geocortex technology helped meet local Source Protection Plan requirements

March 6, 2019

Integrating Business Intelligence and Data Sources with Geocortex Essentials [Webinar]

March 1, 2019

How to quickly add attachments to new features when editing [Geocortex Tech Tip]

February 22, 2019

Generating a report with sub reports from external data sources [Geocortex Tech Tip]

February 20, 2019

Geocortex Essentials 4.11: Saving Time & Increasing Efficiency

February 15, 2019

Accessing Samples and Building your First Workflow [Geocortex Tech Tip]

February 12, 2019

Open Beta of Geocortex Printing 5 Has Begun

February 8, 2019

Different Ways of Creating Selections of Features in Geocortex Viewer for HTML 5 [Geocortex Tech Tip]

February 6, 2019

4 Best Practices to Follow When Using Geocortex Workflow 5

February 1, 2019

Creating a Report that Displays a Screenshot of the Map [Geocortex Tech Tip]

January 28, 2019

Diving Into Geocortex Reporting 5 [Geocortex Tech Tip]

January 24, 2019

How Geocortex is Advancing Water Management Solutions

January 16, 2019

Creating Custom User Experiences with Geocortex Workflow 5 [Webinar]

January 11, 2019

Showing the search results using the item picker in Geocortex Workflow 5 [Geocortex Tech Tip]

January 9, 2019

City of Troy: Using GIS and asset management technologies to manage legislative requirements

January 4, 2019

Using scripting to put attachments in reports in Geocortex Reporting 5 [Geocortex Tech Tip]

Open: 2018
2018
December 21, 2018

Integrating Pictometry, Bing and other 3rd party maps within your Geocortex applications

December 19, 2018

Recapping the Texas Geocortex Regional User Group

December 14, 2018

How to use Geocortex Workflow 5 to populate the Attribute Table in Web AppBuilder for ArcGIS [Geocortex Tech Tip]

December 12, 2018

Finding yourself: Using geolocation in mobile and web applications [Webinar]

December 7, 2018

Enabling real-time user-to-user map collaboration within Geocortex Essentials

December 5, 2018

Reflecting on 2018

November 30, 2018

Creating mailing labels with reports with Geocortex Reporting 5 [Geocortex Tech Tip]

November 29, 2018

Alberta Energy Regulator: Supporting safe and responsible energy resource operations

November 26, 2018

Important update for ArcGIS and Transport Layer Security (TLS) Protocol Support!

November 23, 2018

Using fine-grained security to control access to layers, features, attributes and application functionality [Geocortex Tech Tip]

November 21, 2018

Enhancing Web AppBuilder for ArcGIS® with Geocortex Reporting [Webinar]

November 16, 2018

Using Geocortex Workflow 5 to automatically display a form for editing layer attributes [Geocortex Tech Tip]

November 15, 2018

Geocortex Achieves Esri’s “Release Ready Specialty” Designation

November 14, 2018

Celebrating GIS Day with York Regional Police: How GIS Data Has Mitigated Risk & Increased Efficiency in Crime Prevention

November 9, 2018

How to access a SQL database from a workflow using Geocortex Workflow 5 [Geocortex Tech Tip]

November 2, 2018

How to send an email from a workflow using Geocortex Workflow 5 [Geocortex Tech Tip]

October 26, 2018

How to add and configure charts inside reports with Geocortex Reporting 5 [Geocortex Tech Tip]

October 24, 2018

Geocortex Water Webinar Series

October 19, 2018

Integrating Geocortex Essentials with ArcGIS Online and ArcGIS Enterprise portal [Geocortex Tech Tip]

October 17, 2018

Cross-Platform Development with Xamarin [Webinar]

October 12, 2018

City of Fort Collins: Dynamic flood maps for public awareness, and flood insurance rate saving

October 2, 2018

Technology Q&A: Geocortex Workflow 5 “Behind the Firewall”

June 27, 2018

Geocortex Essentials 4.10 is here!

June 12, 2018

Geocortex and the GDPR

June 6, 2018

Geocortex at the 2018 Esri User Conference

May 15, 2018

Technology Q&A: The evolution of Geocortex and Web AppBuilder for ArcGIS

April 25, 2018

How to manage data collected from Geocortex Workflow 5 forms [Geocortex Tech Tip]

April 18, 2018

Delivering accessible mapping applications for everyone [Geocortex Tech Tip]

April 11, 2018

How to search for data in a non-spatial database [Geocortex Tech Tip]

April 5, 2018

Configuring Geocortex Analytics to monitor a new Portal for ArcGIS instance [Geocortex Tech Tip]

March 27, 2018

Getting started with forms in Geocortex Workflow 5 [Geocortex Tech Tip]

March 21, 2018

Using Geocortex Workflow with Web AppBuilder for ArcGIS [Geocortex Tech Tip]

March 15, 2018

Understanding tool usage in your GIS applications [Geocortex Tech Tip]

March 7, 2018

Running Geocortex Essentials workflows from an identify operation [Geocortex Tech Tip]

March 2, 2018

GIS Health Assessment: A new way to think about your system

February 28, 2018

Using the in-app help system in Geocortex Workflow 5 [Geocortex Tech Tip]

February 21, 2018

How to configure a personalized dashboard in Geocortex Analytics [Geocortex Tech Tip]

January 25, 2018

GIS is shifting to SaaS, and it’s a win for everyone


Categories

Popular Tags
Accessibility Active Operating Picture ArcGIS ArcGIS Online customer spotlight Customer Story Data Models Energy Esri Geocortex Geocortex 5-Series Geocortex Analytics Geocortex Essentials geocortex integrations geocortex mobile Geocortex Mobile Viewer geocortex printing Geocortex Printing 5 Geocortex Reporting Geocortex Reporting 5 geocortex tech tip Geocortex Tech Tips geocortex training Geocortex Viewer for HTML5 geocortex web Geocortex Web Viewer Geocortex Workflow Geocortex Workflow 5 GIS GIS Day GIS Health gis integrations Integrations Oil & Gas Pipelines Portal for ArcGIS SaaS Tech Tip Tech Tips Transportation vertigis Water Industry Web AppBuilder Web GIS Xamarin

Contributors