repeat with multiple geopoint

614
5
10-26-2022 12:00 PM
JohnMedema
New Contributor III

Greetings,

I have a survey form that leverages a repeat to capture inspection information, and each inspection requires an embedded repeat that captures two sets of latitude and longitude coordinates.  When I submit the form the resulting feature service (hosted) contains 2 layers and one table.  One of the layers contains the captured lat/long values (from the nested repeat). The other layer holds the information captured in the survey that is not within the repeat group.  Finally the table contains the information captured date from the survey repeat. 

JohnMedema_0-1666810688661.png

 

I want to create a web map that will show the captured lat/long points but also configure the pop up to display the values from the table.  

0 Kudos
5 Replies
DougBrowning
MVP Esteemed Contributor

So you want to display values form the parent in the child or child in the parent?  

If so FeatureSet is what you want

You can try Relationship name but sometimes it fails on certain naming.

var tbl = FeatureSetByRelationshipName($feature, "Points", ['DesignLat'], false);
return First(tbl).DesignLat

If it fails manually query it like this

var sql = "PointID = '" + $feature.PointID + "'";
var tbl = Filter(FeatureSetByName($map,"Points", ['DesignLat'], false), sql);
return First(tbl).DesignLat

You can also add the fields to your form and pass them in or inherit them down the repeat.

Hope that helps

JohnMedema
New Contributor III

Hi Doug,

I was able to execute a one to many join (parentrowid to the uniquerowid).  I have a few follow up questions.  

1.  Will that join be applied to each new survey that is submitted? Or how can I ensure that the join is applied to all submitted surveys moving forward?

2.  There is a section in my survey that captures data outside the repeats. I configured the survey form this way so specific information needs only to be input one time by the user. That information applies to to each set of collected data in the repeat, there is no need to capture spatial information for that general info, but I am still getting a point layer for that section.  Is there a way to disable that so I am not getting a random point on my map that is showing up some distance south of Ghana in Africa?

JohnMedema_0-1667335287289.png

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Sorry you lost me none of what I posted uses a join.  This is all Arcade in the popup.

But for the 0,0 all forms have GPS.  They have to be be a Feature layer.  So if you hide the spatial at the root of the form then they all get 0,0.  I would not hide it.  Knowing where they were when they used the form is always handy.  We see users in the wrong spot all the time.

0 Kudos
JohnMedema
New Contributor III

Apologies for the tangent on using the join.

A better question; leveraging Arcade in the pop-up, would the expressions you suggested be applied to all submitted surveys?

Thanks for the help Doug.

0 Kudos
DougBrowning
MVP Esteemed Contributor

The Arcade goes in the popup in the Map. So anything you clicked on it would fire.  It is just values for display you of course cannot map using lat/long number fields.

If you are trying to show the main form in the location from the repeat I would just use a calc to grab that all in the form.  Parent always needs Geo.

You can use an if though like this example only runs on Points marked done

 

 

if ($feature.EvalStatus == "Eval") {
var sql = "PlotKey = '" + $feature.PlotKey + "'";
var tbl = Filter(FeatureSetByName($map,"Species Richness", ['PlotKey'], false), sql);

var tblCnt = count(tbl)
if (tblCnt < 1) {
    return "\n----No Species Richness form found!"
}
else if (tblCnt > 1) {
    return "\n----More than 1 Species Richness form found!"
}
else {
    return ''
}
}
else {
    return ''
}

 

 

 

0 Kudos