Arcade Filter by Date

1599
3
Jump to solution
05-06-2020 06:52 AM
KevinBrown10
New Contributor III

Hello, 

I wish to utilize the Filter function in Arcade to only return results between 1/1/2019 and 12/31/2019.  I understand the Filter function is  Filter(featurerSet, filter) where filter is an SQL text string.  The features are stored with a Date/Time field.  I am just not understanding the proper SQL commands for working with Date/Time. 

Any help or direction to more resources is appreciated.   

I tagged you Xander Bakker‌ because I (a non-programmer) have learned much about Arcade following your numerous examples and help to others on GeoNet. 

Thanks.

Kevin

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Hi k.brown ;

It seems that the expression below works (the same format as you would use in Desktop):

var sql = "LASTUPDATE BETWEEN date '01/01/2019' and date '12/31/2019'";
var fs = Filter($layer, sql);
return Count(fs);

View solution in original post

3 Replies
XanderBakker
Esri Esteemed Contributor

Hi k.brown ;

It seems that the expression below works (the same format as you would use in Desktop):

var sql = "LASTUPDATE BETWEEN date '01/01/2019' and date '12/31/2019'";
var fs = Filter($layer, sql);
return Count(fs);
KevinBrown10
New Contributor III

Perfect!  This worked for me.  

Thank you very much for your quick response.  As I stated, I do not have much coding experience but following along with your examples is very helpful.

Much appreciated.

KB

XanderBakker
Esri Esteemed Contributor

Hi https://community.esri.com/people/k.brown,

I'm glad it worked! 

0 Kudos