Thanks again for your help on this.
I updated my script to the following and while the returned numbers seemed valid when testing, the return lacks information in the SIZE and RISKCNT fields.
What am I doing wrong?
var p = Portal('https://maps.xxxxx.com/portal/')
var sql = "(DATE > CURRENT_DATE - 7)"
var sqlST = "(STATE = 'CO')"
// the polygon layer
var fsHail = FeatureSetByPortalItem(p,
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
0, ['label', 'SIZE', 'DATE_TEXT'], true
);
var fHail = Filter(fsHail, sql);
// the pts layer
var fsInforce = FeatureSetByPortalItem(p,
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
0, ['PolicyNumber', 'LocationID', 'LOB', 'TIV', 'RiskCount'], false
);
var fInforce = Filter(fsInforce, sqlST);
/*Count(fInforce);*/
// output dict
var out_dict = {
fields: [
{name:'SIZE', type:'esriFieldTypeInteger'},
{name:'RISKCNT', type:'esriFieldTypeInteger'}
],
geometryType: '',
features:[]
}
// loop through polygons, get points
for (var f in fHail) {
var xs_pts = Intersects(f, fInforce)
Push(
out_dict['features'],
{
attributes: [
{
SIZE: f['SIZE'],
RISKCNT: Count(xs_pts)
}
]
}
)
}
return FeatureSet(Text(out_dict))