ArcGIS Pro using Arcade and Tags in Map Series Layouts

Have you ever wanted to create a custom variable on an ArcGIS Pro map series layout? Not a simple dynamic context, but say change the color of a text element to red if the value in a field is false and green if it is true? Maybe change a logo based on the owner of a property or business?

  • Jason Tromborg, Jacqui Martin, Dallas Crow

Hello everybody!

Yesterday, I collaborated with JacquiMartin and DallasCrow to develop a method for changing the font color in a layout based on conditional statements (more specifically, a map series). When a dynamic text is applied, XML tags are generated in the Format Text window. This works by creating a duplicate tag into which the formatting tags are passed without closing tags. In step 5, we manually close tags using </CLR>, however this can also be done dynamically if needed. If you want to alter the color or style depending on conditional arcade, you would just add the conditions in the first-most tag and copy and add another closing tag with the same conditional statements in the first-most tag. You only need to return closing tags corresponsing to the opening tags.

This is a workaround that is susceptible to failure when the font expands outside the bounding box in the layout. These are typically only visible after picking a different page from the map series. Additionally, pay attention to the spaces and use the labeling syntax located here.  
  
1. Create a dynamic text element and select Table Attribute for the source. In the Arcade select the field you want dispayed.

2. Click on the view source tag above the dynamic text box tag area. Copy the source code and paste a second copy of it above. 

You should now have 2 tags when you switch back to tag view.   
  
3. Click on the first-most tag (the one we pasted in the front, really it just needs to be the first tag not the second).   
  
4. Edit the Arcade to be something similar to this...

IIF($feature.hexagonID == 401, "<CLR red = '4' green = '56' blue = '106' >", "<CLR red = '0' green = '0' blue = '0' >")

  
*Note mind the spaces. Formating has to be exact in the CLR tags.  
  
Click OK and you should see this.

5. Add the close tag for the CLR. `</CLR>` goes directly in the tag section at the end. 

You should now see this in your map series or layout. 

For reference here is section 489...

and here is a screenshot of the entire project...

Be careful not to double-click on a bounding box after this solution is in place otherwise...

you will have to delete the broken tags and start over. It only takes a minute or two if you document your code.   
  
I hope this helps!