Select to view content in your preferred language

Arcade to Display Text if Values Match

07-28-2023 11:11 AM
Labels (2)
Occasional Contributor

Since web map viewer in Portal does not support pop-ups for related tables yet, I'm trying to create a workaround with Arcade.

I want to label features based on if they have one of the three Global IDs from the related table. 


If assignmenttype = {E4929F7E-B6D0-4DB9-8381-522FBAE6EE52} display the text "Hydrant Inspection"

if assignmenttype = {89FFDD54-95A3-41C8-B4A6-EEA3C18448F2} display the text "Valve Inspection" 

if assignmenttype = {64A1361F-4B63-4949-B081-303D55F93346} display the text "Service Inspection"

What would be the best arcade function to configure?

Tags (1)
0 Kudos
3 Replies
Regular Contributor

@MelissaSalich You can definitely create an Arcade expression to show related records in the feature's popup.


You could also write an Arcade expression for symbology.  If there is a Hydrant Inspection, return this symbol.  If there is a Valve Inspection, return this symbol.  If there is both, return this symbol.....


0 Kudos
MVP Esteemed Contributor

You can use the FeatureSetByRelationshipName function (if you're using Portal 10.8 or later) to get the related records for the feature.

var related = FeatureSetByRelationshipName($feature, "the relationship name");
var relatedRec = First(related);
return when (relatedRec.GlobalID == 'E4929F7E-B6D0-4DB9-8381-522FBAE6EE52', 'Hydrant Inspection',
      relatedRec.GlobalID == '89FFDD54-95A3-41C8-B4A6-EEA3C18448F2', 'Valve Inspection',
      relatedRec.GlobalID == '64A1361F-4B63-4949-B081-303D55F93346', 'Service Inspection',
      'No inspection')

 This example assumes there's only one related record for the feature.

0 Kudos
Occasional Contributor

thank you for the help, my dataset does not have a relationship. 

0 Kudos