Select to view content in your preferred language

return single field from Related table Arcade Popup

925
1
Jump to solution
11-11-2022 07:34 AM
Labels (1)
SpatialSean
Regular Contributor

This is probably simple but for some reason I cannot return the field I want in a popup.

This is from a Survey123 feature layer with a repeat.  Within it I have a field that creates a subject line that I want to use in my popup. Instead of returning the value it returns: object, FeatureSet

I've tried going through some of the Arcade solutions but when replacing with my data but then the popup returns blank.

 

 

var heading = '<h2>Event: '+$feature.Problem + ' | Location:  '+ $feature.City + ', '+ $feature.State+'</h2>'

var geninfo = '<p><h3>' + $feature.Info + '</h3></p>'

var subject = FeatureSetByRelationshipName($feature, 'asset_capture',['SubjectLine'])

return { 
	type : 'text', 
	text : heading + geninfo + subject
 
}

 

 

1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Your variable "subject" is a FeatureSet, not a piece of text. You have to get one of the records from it and get the attribute for that record. This modification to your code gets the first record with the "SubjectLine" attribute.

var heading = '<h2>Event: '+$feature.Problem + ' | Location:  '+ $feature.City + ', '+ $feature.State+'</h2>'

var geninfo = '<p><h3>' + $feature.Info + '</h3></p>'

var subject = FeatureSetByRelationshipName($feature, 'asset_capture',['SubjectLine'])

return { 
	type : 'text', 
	text : heading + geninfo + First(subject).SubjectLine
}

 

View solution in original post

1 Reply
KenBuja
MVP Esteemed Contributor

Your variable "subject" is a FeatureSet, not a piece of text. You have to get one of the records from it and get the attribute for that record. This modification to your code gets the first record with the "SubjectLine" attribute.

var heading = '<h2>Event: '+$feature.Problem + ' | Location:  '+ $feature.City + ', '+ $feature.State+'</h2>'

var geninfo = '<p><h3>' + $feature.Info + '</h3></p>'

var subject = FeatureSetByRelationshipName($feature, 'asset_capture',['SubjectLine'])

return { 
	type : 'text', 
	text : heading + geninfo + First(subject).SubjectLine
}