Select to view content in your preferred language

Recommended workflow for Survey IDs between child and parent layer

429
2
02-07-2024 03:29 PM
chill_gis_dude
Regular Contributor

I've created a survey using a parent child relationship between two feature services so that within a given survey the user can create multiple points on the map. My understanding is that this has to be done using the GlobalID which is what I did and it worked great.

I'd like to create a results map showing the surveyors all the points they've made, which would have a point where the survey started from the parent layer, along with multiple points from the child layer. Ideally these points would all have a linking ID in the label or pop-up so that you'd know what child points go with what parent point. I understand the global ID could do this, but I don't know anyone that could match global IDs at a glance, they are not incremental and they look like randomized string text. Is there a recommended workflow for what I am trying to achieve?

I am basically looking for an autoincrementing ID with a one to many relationship between the child and parent layer of my survey. People have suggested the object ID but in my experience that has always been a finicky field and it is not constant. Thanks for any help!

0 Kudos
2 Replies
MobiusSnake
MVP Regular Contributor

I've done this kind of thing in the past:

  • I create a "processed" field (integer) on both the parent and child layers, with a default value of 0.
  • In maps/apps, I filter the layers so that only features with a processed value of 1 is displayed.  This can be done using a hosted feature layer view or filters within the map.
  • I set up a Notebook that scans the layer for records with a processed value of 0.  This notebook using Python to assign IDs using whatever logic I need that can't easily be done in the field (usually other types of enrichment as well).  As each record is updated, the processed value is set to 1.
  • I schedule this notebook to run a few times per day.

One approach might be the OID of the parent plus the OID of the child, with a hyphen between the two.

This means that new records aren't immediately visible in maps/apps, they only become visible once they've been properly processed by the notebook.  This may not be suitable if you need realtime or near-realtime visibility of incoming records, but for a lot of applications it should be fine.

0 Kudos
DougBrowning
MVP Esteemed Contributor

If you just want the repeat children to number 1, 2, 3, 4 you can use position() in a calc and once(position()) can help if they navigate the repeat a lot.  But note it is not always perfect.  If a user goes back a few repeats and deletes a record, then adds a new one at the end you will get dup numbers.  

But I would wonder what is this used for.  I get people are accustomed to seeing the child numbers in order but it does not really serve a data purpose.  In map viewer you can sort the children and all that so not sure you would really need it for anything. Once the data is in AGOL it will have the objectid and it will be sequential. 

Me personally I use keys of text that make sense and not globalids.  If you ever move the data or have to reload it globalids go bad fast.  I created my own second relate as posted here  https://community.esri.com/t5/arcgis-survey123-questions/mapping-with-survey123-within-a-polygon-or-...

Hope that helps

0 Kudos