Hi, I have features with a related table and I am trying to write a calculated expression in Field Maps to calculate a field in the related table that I have added into my Smart Form called "CummulativeNoPhotos".
I'm trying to calculate a field with the sum the values from the field called "NumberPhotos" if the battery was not changed up until the last time the battery was changed. Otherwise I want the calculated field to be calculated to 0. I have a field called "BatteriesChanged" in the related table to denote if the battery was changed and a field called "NumberPhotos" to keep track of the number of photos.
Curtently, it seems like it is summing all of the "NumberPhotos" in the entire related table not just the "NumberPhotos" for the specific feature of interest that I'm filling out a related record for. I am not sure on how to get the result I want.
So far I have this:
var record = Filter($featureset, "BatteriesChanged = 'Y'")
record = OrderBy(record, "Date")
if($feature.BatteriesChanged == "Y"){
return $feature.CummulativeNoOfPhotos = 0;
} else{
return Sum(record,"NumberPhotos");
}
Did you get this figured out? I have a similar situation and I am looking for information on how best to solve it.