Hi @HusseinNasser2
I am using the code that was shared here but I got an unexpected error:
I get the following error
invalid arcade expression, arcade error: expected attachment type, script line: 4
My attribute rule:
var features = FeatureSetByName($datastore,'SewerLine', ['*'], false);
var gid=$feature.REL_GLOBALID;
var item=First(Filter(features, 'globalid = @gid'));
var count = Count(Attachments(item));
if ($editcontext.editType == 'DELETE'){
var count_total=count-1
} else {
var count_total=count
}
return {
'edit': [{
'classname' : 'SewerLine',
'updates' : [{
'globalid': gid,
'attributes' : {'NumAdjuntos' :count_total }
}]
}]
}
I have tried the same Count(Attachments()) line and it is valid arcade for calculated fields.
I'm using ArCGIS pro 2.9.11 and enterprise 2.9.1
Thanks!