What’s New in Arcade (June 2017)

Arcade has been popping up in more places with each release of ArcGIS, so it only makes sense to add more support for Arcade into the pop-up itself.  In this update of ArcGIS Online, we are introducing the concept of attribute expressions. You can leverage attribute expressions in pop-ups by defining an Arcade expression to create attributes for your pop-up.  You can use attribute expressions just like regular attributes to show information or create charts.  These attributes are calculated on the fly when you open a pop-up and are not stored as part of your layer’s data.  This allows you to do several interesting things to improve the presentation of your data. Below are just a few examples.

The screenshot below shows summary information from a water well database.  You’ll notice that the values for Depth to Bedrock and Static Water Level are both 0.00.  This is because both fields are numeric.  So, what does 0.00 mean? Does it mean bedrock is exposed at the surface or that the value was not recorded?  Clicking the link to get the PDF well log will show you immediately that the values were not recorded.

It would be nice to make that information obvious to any user exploring the map. Arcade can help. The Configure Pop-up pane now has a new section called Attribute Expressions where you can solve this problem by defining a new Arcade-based attribute. In this case, we added a simple expression to substitute 0.00 for the text “Not Recorded” and to append the unit of measure to the recorded value.  That expression looks something like this:

IIf($feature.DP_BEDROCK == 0, "Not Recorded", $feature.DP_BEDROCK+ " m")

Once that attribute expression is added to the pop-up, you can use it just like any other attribute in the popup. The result is a clearer message to the user about the data they’re looking at.

That’s a simple example. What about that PDF link?  The link was created using attribute expressions as well. In this case, we used part of the Well_ID field and the whole Well_ID field to build a quick link to the paper well log for each water well.

"https://www.ontario.ca/sites/default/files/moe_mapping/downloads/2Water/Wells_pdfs/" 
+ Left($feature.WELL_ID, 3) + "/" + $feature.WELL_ID + ".pdf"

Hopefully this is starting to pique your interest.  Let’s look at a few more quick examples using some monthly sales data. Using attribute expressions on this dataset with sales by month, we can quickly create new attributes in the pop-up to show additional metrics. For example, you might want to show annual sales, average monthly sales, performance, and best month figures for each sales person in an organization.

In this example, four additional metrics are created using attribute expressions. You can turn them on and off in the pop-up through the Configure Attributes section of the pop-up configuration.  Any new attribute expression is visible by default in the pop-up.

  • Best Month: uses the Max() function to highlight the best month that the sales person had
  • Avg Mo Sales: calculates the average monthly sales for the sales person
  • Annual Sales: uses the Sum() function to add all the monthly sales data together
  • Performance: looks at the average monthly sales value and categorizes it based on sales targets

The result is a pop-up summarizing key metrics about the data that are always up to date as the dataset is updated and changes.

In addition to attribute expressions, we’ve made several improvements to the Arcade editor itself this release. The first improvement makes it easier to work with coded value domains. In Arcade, attributes by default return the value code and not the description name of the domain. This can lead to confusion when the code and name differ from one another. Now, if a field has a coded value we include a snippet shortcut on the Globals tab to insert the code snippet needed to compare the domain description name.

Additionally, if you modify the test value (by clicking the pencil icon) for a given attribute, we now show you the full list of coded value domain entries to make it faster to work with.

Continuing in the theme of saving you time, we’ve also added a new tab called “Existing” to the Arcade editor.  Under this tab, you’ll find all the existing expressions that have been authored for the layer, whether in the pop-up, the style options, labeling, or rotation.  This tab allows you to quickly copy an existing expression so that you can use it in another place where Arcade is supported.  For example, if you created a style in Arcade, you might want that value to show up in the pop-up.  The “Existing” tab speeds up the process.

Right now, attribute expressions will only work when using ArcGIS Online or with the latest JS API’s (either 3.21 or 4.4 coming very soon). However, you will gradually see them make their way to the entire platform in future releases. Attribute expressions are about giving you the flexibility to create great looking pop-ups with minimal work. We can’t wait to see you put attribute expressions to work in creative and interesting ways.

This entry was posted in ArcGIS Online and tagged , , , . Bookmark the permalink.

Leave a Reply

11 Comments

  1. ekola says:

    Hi, does anybody know when it will be implemented to Portal for ArcGIS? Thank you.

    • Paul Barker says:

      Hi you should see it make its way into Portal over the next few releases. It will not be in 10.5.1 though

      • andrew.parnell_mpi says:

        Cannot wait until that happens. The flexibility that it will allow for visualisations from within the webmap. Definitely a game changer not having to create fields or data purely for visualisation.

  2. matt2521 says:

    Tried JSAPI 3.20 and 4.3 and i don’t see the results of my Arcade expression in the popups. Do we need to wait for the next release(s)?

    • Paul Barker says:

      Matt, my apologies. In the excitement to get this out I forgot to update the version numbers. Should see this in the imminent 3.21 update and 4.4 api release

  3. jms1222 says:

    Hi Paul,

    A couple of questions. First, can Arcade expressions reference Related Data that has been published with features from ArcMap/ArcGIS Pro? For instance, let’s say I have a feature layer of gas stations, that includes a related table of what types of fuel are offered at each location (i.e., unleaded, diesel, e85, CNG, etc). I’m finding that in pop-ups I want to include ONLY those pieces of related data that are relevant. For instance, if a gas station only offers unleaded and diesel, no need to include e85 or CNG. Right now it seems you can only click the “Show Related Records” link to pull up a table, or include a count/sum/max/min etc for the value in a related field.

    Second, can you use Arcade expressions to color code values if they meet a certain threshold? For instance, if the gas station is built after 1980, color the symbol green. If it’s between 1970-1980, color it orange, and if it’s before 1970 then color red.

    If we need to take this offline, let me know your email address and we can discuss this way. Thanks!

    • Paul Barker says:

      jm1222

      Great questions both of which came up multiple times last week at the user conference so you are not alone in looking for this functionality. Regarding text formatting that is something that is currently under discussion as a future enhancement.

      In regards to your other question. Conditional visibility, and improving the default popup experience when working with related information is something that we are also exploring. Currently however Arcade only works on the feature level and not against its related data, that is something we might look at though as Arcade grows and becomes more mature.

  4. mariasakirkina says:

    Hi Paul,
    I tried to use data with coded domain, and codes are presented by letters (geological reductions).This kind of domain is unvisible in Arcade window. Is it planned to fix this feauture in next releases?
    Thank you!

    • Paul Barker says:

      mariasakirkina

      Text based coded value domains should work fine and are supported. You can either access the code value by using $feature.fieldname or access the name of the description by using DomainName(“fieldname”). If that isn’t working please reach out to support so that we can investigate further.

  5. Jason Matney says:

    Hi Paul -
    What would course of action would you recommend if I *did* want to store the results of attribute expressions to the database?
    For example, right now I have a layer which includes Salaried Dollars and non-Salaried Dollars.
    I’m using an attribute expression to display the sum of these attributes as Total Salary Dollars.
    Is it possible to somehow store the Total Salary Dollars in the database?
    Thank you,
    Jason Matney – NC State University

  6. khillstrom says:

    Will you be able to use it for conditional formatting of popup contents. I tried custom HTML, but to get the expression to work it needed to be in quotes which resulted in it displaying the HTML, rather than publishing the formatted text.