I'm currently trying to create a pop-up which pulls data from related tables.
I've been successful in puling data from the table immediately related to the feature layer. But there is a table related to that related table that I also want to pull data from. The feature layer is a polygon, the related table has species that occur within that polygon and the secondary related table is supplemental information about that species.
Feature Layer <> Related Table <> Related Table
This is my current expression for my feature layer:
var relatedrecords = FeatureSetByRelationshipName($feature,"Provincially_Tracked_Species_Detail");
var popupString = ""
for (var f in relatedrecords){
popupString += Text(f.Com_Name) + TextFormatting.NewLine +
"Scientific Name: " +
DefaultValue(f.Sci_Name, 'no data') + TextFormatting.NewLine +
"Taxon: " +
DefaultValue(f.Lower_Taxon, 'no data') + TextFormatting.NewLine +
"SARO Status: " +
DefaultValue(f.SARO_Status, 'no data') + TextFormatting.NewLine +
TextFormatting.NewLine
}
return popupString
These are my results:

I have also made an expression for my first related table pulling data from the second related table but because it is an expression not a real field it won't let me use it like any of the other fields (as I did with other fields in the above example).
Hopefully, this makes sense. If you have any suggestions on a solution, please let me know.