Select to view content in your preferred language

Get 1:M related objects using Arcade

13241
25
02-01-2019 04:44 PM
LindsyHales_Bentley
Occasional Contributor

Branched from: https://community.esri.com/thread/196867-get-related-objects-in-arcade 

I have a pipeline fc with geometry(fittings are drawn to scale as a polygon) with diameter, and globalid fields. 

And then a view(table) containing asset name, attribute value, and a GISid.

This is a one-to-many relationship (GISid = globalid) because a section of pipe could have multiple materials (inner, outer, encasement, coatings, etc.).

I want to show the related information in the pop-up of the pipeline.

25 Replies
XanderBakker
Esri Esteemed Contributor

ahmadabusaleh , yes there is, but not in a single expression in AGOL yet. You would need several expressions, one to return the text and the other to define the color, and use both in a custom HTML pop-up

XanderBakker
Esri Esteemed Contributor
AhmadSALEH1
Frequent Contributor

Thanks  Xander Bakker‌, looks good. 

for my case I want to stay away from using HTML pop-up and keep using the table pop-up view which looks like it does not   support color manipulation.

Thanks a lot  

0 Kudos
by Anonymous User
Not applicable

Hey Xander, 

I was wondering if you know how to bring the count back into the table instead of the polyline? Is there a way to reverse these as an attribute rule that applies as an instant calculation when a relate occurs?

 

For instance, I am attempting to set up a similar calculation with Centerlines (polyline) and a Master Roads (table), where the centerline derive their street name fields from the Master Road Name table, and then calculates the number of segments as a count.

 

There is globalID from the table, that feeds into the Centerlines feature class as the foreign key.

 

Appreciate the help! 

0 Kudos
by Anonymous User
Not applicable

I figured out a way to do it that does work. May not be the best way, but with limited scripting knowledge, what works is what I need at the moment.

 

##

// Identify Primary Key between relationship

 id = $feature.streetnameid;

// Create the sql to select the related items in RoadCenterline Layer
var sql = "F_streetnameid = '" + id + "'";


var asset_view = FeatureSetByName($datastore,"RoadCenterline");
var assets = Filter(asset_view, sql);
var cnt = Count(assets);
return cnt

 

Just wanted to put it out there incase anyone came across this problem.

Rice_GIS
Occasional Contributor

Is there a way to run this expression where you can group the data by attribute from a field in the related data?

0 Kudos