Select to view content in your preferred language

Calculated expression works in AGOL web map, but not in field maps

305
2
Jump to solution
04-07-2025 11:26 AM
TyrelBorowitz
Occasional Contributor

I've got an expression which I use to update a status field for a point feature layer (BikePedCountSites). The expression takes the status value from the most recent related record (BikePedCountRecords), which then allows me to symbolize the point features by if they are "Active" or "Done". I felt very proud of myself when I got this to work in the web map. I am able to update the related record and the expression updates the status value for the point layer. However, when I went to update and add new records using field maps the expression fails to calculate and does not update the status field of the point layer.

var relatedrecords = FeatureSetByRelationshipName($feature, 'BikePedCountRecords_122023',)
var output;

var sortedrecords = OrderBy(relatedrecords, 'DatetimeInstalled Desc');
var latestrecord = First(sortedrecords);
output = Text(latestrecord['Status']);

return output


0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

you are missing the field name here. start there

var relatedrecords = FeatureSetByRelationshipName($feature'BikePedCountRecords_122023',['AddFieldName'], false)

View solution in original post

0 Kudos
2 Replies
DougBrowning
MVP Esteemed Contributor

you are missing the field name here. start there

var relatedrecords = FeatureSetByRelationshipName($feature'BikePedCountRecords_122023',['AddFieldName'], false)

0 Kudos
TyrelBorowitz
Occasional Contributor

That did it. Thanks!