Select to view content in your preferred language

Ask about the Related table came from the repeat table in Survey123 for ArcGIS, How to show its data in pop-up?String fields or numeric,both!

2215
5
10-27-2019 03:33 AM
AlainMunyaneza1
Emerging Contributor

Hello, I am called Alain Roland Munyaneza. I continue to have an issue with how to get the data from the related table came from the repeat table table in survey123. I tried to follow similar arcade expressions from questions that were asked here from GeoNet but I do not get the fields! In fact, I have two separate tables that I want to show in each table the data that are in. I have one table for owners and another for areas. I want all these data in pop-up. For the first table, I want to the Owner first name and the Owner Family Name. I tried to use the FeatureSetbyRelationshipName function but it doesn't give out. I tried to use too FeatureSetbyName and FeatureSetbyID but all  I do not get. When I follow the example given here for arcade, I put ParentGlobalID for the parent layer and GlobalID for the table but it doesn't work. Does anyone guide me how to do this?

0 Kudos
5 Replies
AlainMunyaneza1
Emerging Contributor

I used this label and it is showing in pop-up  but not in dashboard. What is the problem?

var results = $feature["globalid"];

var sql = "parentglobalid = '{" + Upper(results) + "}'";

Console(sql);

var tbl = FeatureSetByName($map,"service_71239bb2bb8c4d13a46fa8f038cceec6 - Owners");

var related_data = Filter(tbl, sql);

var cnt = Count(related_data);

var result = cnt + " related records";

 

if (cnt > 0) {

     for (var row in related_data) {

         var line = TextFormatting.NewLine + row.OwnerFirstName + " " + row.OwnerFamilyName;

         result += line;

     }

} else {

    result = "No related records:";

}

 

return result;

0 Kudos
DougBrowning
MVP Esteemed Contributor

It could you changing to upper case on the globalid?  Not sure why that would be needed.  

I would also check the name of the layer.  Try remaming it in the map to a shorter name like just Owners.

You can also clean up the code a bit by writing this way.

var sql = "PlotKey = '" + $feature.PlotKey + "'";
var tbl = Filter(FeatureSetByName($map,"GAP"), sql);

var txt = ''
for (var f in OrderBy(tbl,"LineNumber")) {
    txt = txt + f.LineNumber + ' '
}
txt = Left(txt,Count(txt)-1)
if (txt != '1 2 3') {
    return "\n----Gap Line Number Issue! Found: " + txt
}
else {
    return ''
}
}
else {
    return ''

The other option is to create a relationship class in your service between the two.  Then the Pop up attribute box will have all the related records there for you automatically.

Hope that helps.

0 Kudos
Amanda__Huber
MVP Regular Contributor

var tbl = FeatureSetByName($map,"service_71239bb2bb8c4d13a46fa8f038cceec6 - Owners");

@AlainMunyaneza1 I think you need to use the $datastore global to pull S123 repeats/related records into your arcade. Similar to this: 

Amanda__Huber_0-1607457926680.png

Hopefully that helps and works for you too!

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Alain,

This might be better addressed by Operations Dashboard for ArcGIS

0 Kudos
AlainMunyaneza1
Emerging Contributor

Hey, James & Doug,

It accepted after with another trial but Thanks all for your directions.

0 Kudos