Using Arcade scripts and conditional logic in Geocortex Inline Designer (a web-based interface that lets you create interactive straight-line diagrams and alignment sheets, allowing you to present your linear referenced data to your users in a dynamic way) gives you total flexibility when it comes to applying logic to your functions and labels.
Watch us highlight how this works in this week’s Geocortex Tech Tip, where we’ll show you a few different examples on how to configure conditional logic in Geocortex Inline with varying complexity and attributes.
Video Transcript
“Hello. My name is Colin Doak, I am a Technical Advisor at the Partners team here at VertiGIS. I’m going to show you how to configure conditional tool tips and labels in Geocortex Inline. Let’s get started!
Geocortex Inline Designer provides an easy-to-use interface for quickly configuring your inline views. One of the things you can do in Designer is configure conditional logic into your tool tips and labels. I’m going to show you that right now.
So, we’ll start with the ‘Road Attribution band’. What we’re going to do is look at some of the chart options for the charts that are configured here.
First, we will start with an easy one. We’ll have a look at the lanes. Here, we have the ‘Text Function’. This is the tool tip Text Function for lanes. It’s very simple, it’s just a string concatenation of a number of lanes for the actual attribute. ‘NO_LANES_I’ here. The attributes are accessible through the data array. So that’s an array appended by the ‘d’ and then the name of the field that you want to have displayed. If you use that, then you are able to access that in a text function or in a label.
This is a very simple example, but what if we wanted to present a more complex set of attributes. Perhaps put a bunch together, or in other cases where you’ve have a quoted domain or other values that you want to present in a more friendly manner. Then, we can use conditional logic and our text functions.
This is done using Arcade scripts. I’ll show you one right now. Here, we are looking at the guard rail chart and the Road Attribution band. Over here, we can see the text function. Right away, you can see that it’s much more complex. It’s a combination of string concatenation as well as some conditional logic about how we are going to present the guard rail position attribute.
You can notice right away that we are using a ‘when’ operator, which is our first hint that we are using an Arcade script to write this. So, whenever I’m writing a text function that includes Arcade scripts, I like to use Esri’s Arcade Sandbox. In here, we have the same script that we have in the inline text function there, only formatted a little nicer.
What I can do here is that I can immediately find out whether there is any errors, you can see that immediately if there is a missing comma, if there is a syntax error, the sandbox will tell me. But, I could also introduce a dummy attribute or dummy variable in order to test the actual script.
In this case, I’m creating an object ‘D’ which represents our dataset, and that is an object that includes a set of key-value pairs. In this case, we’re only looking at Guard Rail pairs. So, this object has a ‘GUARDRAIL_POSITION’ and I’ve set the value to be ‘LM’, which represents left median.
So, right away, I can test that, see that the result is Left Medium, which is exactly what we’d expect and also test cases which it’s ‘null’, where it defaults to the ‘Undefined’.
So, we know that this script works fine. So, what we can do is go ahead and paste that back into Geocortex Inline and we are confident that it’ll work when it’s deployed.
Let’s look a little more complex example. In this case, we’re looking at attenuators and if you look down at my text function, you can immediately see that there is a lot more going on here. I’ve got three different variables and we are concatenating them together, again using ‘when’ operator to present a more user-friendly display of the attribute. Of course, this is a little hard to read, so let’s have a look at it in the Arcade Sandbox.
Here, we can see that we have three ‘when’ operations, again three different attributes, concatenating them all together, in a nice user friendly, easy to read single string.
Let’s have a look at some of this in action. I’ve deployed this particular view to Geocortex Web with Inline. Let’s go ahead and select a route and right ahead we can see that I’ve got my ‘Road Attributions’ band here and there we have our tool tips appearing as we expect.
Here we have a more complex one and our attenuator is up here. We have our type, side, and direction attributes being presented in a user-friendly way.
So, using Arcade scripts and conditional logic, you are able to apply logic to your text functions as well as your labels in Geocortex Inline.”
Want to see more of Geocortex Inline in action? Click the button below for more information about the product, or to book a personal demo.