Pulling in information for related tables into pop ups using globalids and parentglobalids

1196
4
02-18-2022 09:46 AM
Labels (1)
KyleMcElroy
New Contributor III

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?

KyleMcElroy_0-1645205917005.png

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!

 

0 Kudos
4 Replies
jcarlson
MVP Esteemed Contributor

At the bottom of the $feature section, you should see Related Records, and the other table will be in there.

jcarlson_0-1645206758651.png

 

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']
- Josh Carlson
Kendall County GIS
0 Kudos
KyleMcElroy
New Contributor III

Thank you for the fast response!

Unfortunately, I do not see related records at the bottom of the $feature section. 

KyleMcElroy_1-1645207254552.png

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.

KyleMcElroy_0-1645207217255.png

Hence my main confusion. I have related records but something seems to be off to configure expressions?

0 Kudos
jcarlson
MVP Esteemed Contributor

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.

jcarlson_0-1645208865322.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
KyleMcElroy
New Contributor III

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:

KyleMcElroy_0-1645543172850.png

 

Then we use Survey123 to fill out the layer and table:

KyleMcElroy_1-1645543236762.png

 

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. 

 

0 Kudos