Hello!
I am new to using expressions and arcade with popups and I am finding I am pretty lost going through some of the other posts. I have a related table that using parent global ids and I want to display those attributes in the related table in the popup. When I am expressions window to create a new one, I find the related table under the Feature Layer (the main data in is the RICHAMPS layer, and the related table is Consequence_Table as shown below). When I look under the $feature section under the global tab in the expressions windo, I do not see the related table at all. Therefore, I am getting confused, because I think I need to replace $feature with $database in some of the examples I have seen?
If anyone knows of the best posts that might help with this, I would appreciate it. As I said, I have tried searching and keep getting more confused.
Thanks!
At the bottom of the $feature section, you should see Related Records, and the other table will be in there.
By bringing in your related table this way, it will only grab the records related to the current feature.
One thing to consider: if you have multiple records in the related table, you'll need some way to deal with multiple values. Are you wanting to pick one in particular, or join them together somehow?
The easiest method is to just use First.
var related = FeatureSetByRelationshipName($feature, 'relationship-name')
var rel_feature = First(related)
return rel_feature['some-attribute']
Thank you for the fast response!
Unfortunately, I do not see related records at the bottom of the $feature section.
This is weird because I know they are there as there is a link to table in the pop up as I have the "show related data" checked in the configuration.
Hence my main confusion. I have related records but something seems to be off to configure expressions?
Strange! Well, are you still able to use the "FeatureSetByRelationshipName" function? The relationship name tends to be something like <source layer name>_<destination layer name>, but you can find it in the service's definition on the REST directory page for your service.
So I cannot see the "FeatureSetByRelationshipName" function, and I think this has something to with how this service is set up (I forget to mention that I am working with ArcGIS Enterprise).
I didn't do this part so my tech speak may be off, but I believe everything was set up on the server:
Then we use Survey123 to fill out the layer and table:
I am now looking more into this more, which this post seems like it might be useful (https://community.esri.com/t5/arcgis-pro-questions/access-a-field-value-in-a-layer-that-is-outside/t...) in that I may not be able to do what I want.