Hi! I am trying to create a Dashboard data expression that will let me filter out features without attachments on a feature layer. I'm a noob when it comes to loops and dictionaries. Any suggestions?? I was thinking I'd just add a field to the feature set and store the counts and filter off of that. I've got as far as below, but just doesn't seem to work. I think I'm mixing feature sets with arrays and not pushing correctly.
Otherwise Details shows all the features whether they have attachments or not which is awkward. This would be for an ongoing editing project so doing a one time calculation won't be the trick.
Thanks!!

var responses = FeatureSetByPortalItem(Portal('https://www.arcgis.com'),'e5f9d47a5ee84f0e97a377912cdae9f6',0,['*'],false)
var responses = {
'fields': [{
'attributes': {
'name': 'counts',
'alias': 'Attachment Count',
'type': 'esriFieldTypeInteger'
}
}]
}
for (var nf in responses){
var counts = Count(Attachments(nf))}
responses.counts = {
'attributes':{
'counts': nf.counts
}
}
return responses