Select to view content in your preferred language

Date Range - Arcade - not symbolizing correctly

511
3
Jump to solution
11-13-2023 03:38 PM
BlueSky17
Emerging Contributor

Hi Guys,

I am trying to symbolize survey points that were installed by certain year using Arcade expression:

var revegDate = Date($feature.Date)

if (revegDate >= Date(2022,01,01) && revegDate <= Date(2022,12,31))
{
return "2022"
}

else if (revegDate >= Date(2023,01,01) && revegDate <= Date(2023,12,31))
{
return "2023"
}

else
{
return "2019"
}

The expression doesn't return any errors but my points are not properly colored by year. I should have only one point installed in 2019 (blue). Majority of my survey points were installed in 2022 (243 of them). So, I should mostly see red dots. Only 14 points were installed in 2023 (green) which is the only year displayed correctly. See a snapshot below: 

 

BlueSky17_0-1699918663828.png

 

All data is being entered the same way - it's a download from a handheld device. Please don't advise ideas such as add another field and populate with proper year. I will be downloading this data on a regular basis. Hence, I want to avoid the manual process as much as I can. 

Any ideas what's wrong with my expression or why my points are not symbolized correctly?

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

What type of field is $feature.Date? If it's a Date field, you can simplify this expression.

return Year($feature.Date);

One thing to be aware of with the Date function is months are 0-based, so to create a date for January 1, 2023, you would use Date(2023,0,1). The result of Date(2023,12,31) is January 31, 2024.

 

View solution in original post

0 Kudos
3 Replies
JenniferAcunto
Esri Regular Contributor
Text(Year($feature["Date_Calc"]))

 

JenniferAcunto_1-1699972443970.png

 

- Jen
0 Kudos
KenBuja
MVP Esteemed Contributor

What type of field is $feature.Date? If it's a Date field, you can simplify this expression.

return Year($feature.Date);

One thing to be aware of with the Date function is months are 0-based, so to create a date for January 1, 2023, you would use Date(2023,0,1). The result of Date(2023,12,31) is January 31, 2024.

 

0 Kudos
BlueSky17
Emerging Contributor

Thank you. Thanks for letting me know about the months being 0-based. Didn't know. I adjusted the dates and now my points are being correctly displayed.

Thanks.

0 Kudos