English

How To: Symbolize a range of dates using Arcade in ArcGIS Pro

Summary

A range of dates can be symbolized to represent areas that have and have not been surveyed for a particular period. Arcade functions such as DateDiff(), Date() and Now() can be used to isolate and symbolize specific ranges in a Date data type field.

The following image shows a study of the wilderness in Utah, U.S. The attribute table shows the survey dates for each area.

Bear_Survey_Area

Survey dates.
 
This article describes the workflow to symbolize the areas according to three date ranges: areas surveyed within the last 30 days, areas surveyed more than 30 days and less than 100 days ago, and areas surveyed more than 100 days ago.

Procedure

The following instructions describe how to symbolize the range of dates using Arcade in ArcGIS Pro.

  1. In ArcGIS Pro, right-click the layer in the Contents and click Symbology.
  2. In the Symbology pane, select Unique Value from the Primary symbology drop-down list.
  3. Click the button next to the Field 1 drop-down field to set an expression.

    Expression Builder - Arcade
     
  4. In the Expression Builder dialog box, use the following expression:
    Note:
    Ensure the field used to calculate the range of dates is in Date data type.
    #areas which are surveyed 30 days ago or less belong in the first group
    if (DateDiff(Now(), Date($feature.<field name>), 'days') <= 30) {
         return "Surveyed within the last 30 days" }
    #areas which are surveyed more than 30 days but less than 100 days ago belong in the second group
    else if (DateDiff(Now(), Date($feature.<field name>), 'days') > 30 &&
    DateDiff(Now(), Date($feature.<field name>), 'days') < 100) {
        return "Surveyed between 30 to 100 days ago" }
    #areas which are surveyed 100 days ago or more belong in the third group
    else if (DateDiff(Now(), Date($feature.<field name>), 'days') >= 100) {
         return "Surveyed more than 100 days ago" }
    #areas which do not satisfy any of the given conditions belong in the fourth group
    else {
         return "None of these conditions" }
  5. Click OK to close the Expression Builder dialog box. The symbology is updated.

    Updated symbology.

    Displayed output.
     

Related Information