Edit 1:1 related table with survey123

1427
5
Jump to solution
01-06-2022 02:07 PM
SFM_TravisBott
Occasional Contributor III

Howdy!

I hope what I am trying to do is possible. I would like to edit data in a 1:1 related table using Survey123 and URL parameters. However, I am having trouble feeding the URL the correct GlobalID to access the record in question. I am not sure if this is possible, as what I believe to be the necessary GlobalID is not actually accessible from the parent service. But more details below. 

The basic setup: I have a feature service with two related tables, one is 1:1 and the other is 1:M. I have three surveys that will be used with this feature service. One edits the table of the feature service itself, and is used to update some of the core information, like personnel responsible, etc. This works fine. URL:

 https://survey123.arcgis.com/share/66de662f0ee040cd9e6ffe2b8cb84b16?mode=edit&globalId={GlobalId}

 

The other creates inspection records in a 1:M table. This is also working fine. Note that this relationship is not using a GlobalID, as is typical. I wanted users to be able to use the URL parameter in the web browser as well as add records directly in the mobile app. Each jurisdiction is named uniquely, so that's the key field, and what is fed to the survey from the feature services pop-up. 

https://survey123.arcgis.com/share/4d675461aacf414783efd4718d16696c?field:County={County}&field:City={City}

 

The third table is a long survey, which will only be submitted once. I did not want it to be part of the parent feature service, hence why I put it in a 1:1 related table. This table is related through the GlobalID from the parent feature service, in a field JurisdictionID. However, I believe what I need to feed the URL parameter to edit the related record is the globalID of the related record, which I do not know how to access in the feature service via URL parameter.

Is this possible? Are there potential workarounds? I would like to keep the one-off survey as a separate table since it's incredibly long, and allows separate handling of the core records. 

0 Kudos
1 Solution

Accepted Solutions
SFM_TravisBott
Occasional Contributor III

Sometimes I think it just takes asking for help to push you towards finding your own solution. 

I was stuck just trying to get the parameter to work, but I just added a field to the feature service and calculated over the child's global ID. Since it's 1:1 this shouldn't cause any issues. Now I just feed the URL globalId={ChildID} and it does the job just fine. 

Thanks for your help, though! The engagement is appreciated. 

View solution in original post

5 Replies
DougBrowning
MVP Esteemed Contributor

I have 9-12 forms all related to the main point so I know it well.  I never use globalid for a bunch of reasons.

That said I am having trouble understanding what your actual problem is? 

For me I have a PlotKey in the parent layer that is used in the relationship class and I send that to each form.  I do not edit the main form except for them to mark it as done which we just do in Field Maps since it is just a simple drop down.

My post here may help 

https://community.esri.com/t5/arcgis-survey123-questions/mapping-with-survey123-within-a-polygon-or-...

and why globalids are bad to use is here

https://community.esri.com/t5/arcgis-collector-questions/related-tables-for-offline-data-collection/...

Hope that helps

0 Kudos
SFM_TravisBott
Occasional Contributor III

I will try to clarify my workflow. 

  1. Created feature class with my jurisdiction data
  2. Created two related tables. One is 1:M, linked via the City fields the other is 1:1, linked via GlobalID field in the parent and the JurisdictionID fields in the related table. 
  3. Appended all jurisdictions to 1:1 table (only fields carried over were 'City', 'County', and 'JurisdictionID' sourced from the parent GlobalID field'). So now I have 539 records in feature class, 539 matching records in the 1:1 table, and 0 records in the 1:M table. 
  4. Publish feature class to AGOL, which brings the two related tables with it. 
  5. Create survey #1 - New survey in Connect, based on feature service. This survey edits the main table for the feature service. 
  6. Create survey #2 - New Survey in Connect, based on feature service. In Settings page, change form_id to 1:M related table. Configure survey with fields found in 1:M table
  7. Create survey #3 - New Survey in Connect, based on feature service. In Settings page, change form_id to 1:1 related table. Configure survey with fields found in 1:1 table. 
  8. Open web map with feature service. Configure pop-up. The first URL parameter allows you to edit the core feature service (The first URL in my original post).
  9. Configure pop-up for 1:M table (the second URL in my original post). This feeds the form the 'key' field, which in this case is 'City.' This is likely like the plotkey in your example. 
  10. This is where I'm stuck - configure pop-up to edit the 1:1 table. 

I plan to hand a dashboard to our staff, and I'd like them to be able to edit the core feature service, the 1:M table, and the 1:1 table from the same pop-up. However, I am having a hard time figuring out how to configure the URL to edit the 1:1 table. The mode should be 'edit' since each parent record should have a single related record, right? I could feed it to add a new record, but that's not what I want to do. 

This URL  <https://survey123.arcgis.com/share/0b3887da838e453f8da75f66b2e937a1?mode=edit&amp;globalId={GlobalID}> yields this:

  

SFM_TravisBott_0-1641511225380.png

 

...and this URL <https://survey123.arcgis.com/share/0b3887da838e453f8da75f66b2e937a1?mode=edit&amp;JurisdictionId={Gl...}> yields this...

SFM_TravisBott_1-1641511322583.png

...and this URL <https://survey123.arcgis.com/share/0b3887da838e453f8da75f66b2e937a1?mode=edit&amp;globalId={Jurisdic... yields he same as above. 

What was unclear to me in your workflow was what relationships your related tables had to the parent (1:1 or 1:M). I understand from your post that you do not seem to think you should start from the feature service but I can't really see why not. The workflow seems more or less the same, unless it's in how the relationship is configured. In either case you have a survey and point it towards a new item. The issue here is how to edit a record in a 1:1 related table. 

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Hmm I think a syntax issue maybe.  Sorry never used edit.

I would check this https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-editing-records-in...

Beyond that I am not sure.  Rest looks pretty good to me.

I wonder if you are in the parent popup but want to edit the child?  If so your URL is sending the parent globalid when you prob want the child globalid.  If so I have some arcade code that uses feature set to do lookups into other layers.  So basically go find the child globalid then pass that in the URL.  Let me know if that is it.

 

0 Kudos
SFM_TravisBott
Occasional Contributor III

Sometimes I think it just takes asking for help to push you towards finding your own solution. 

I was stuck just trying to get the parameter to work, but I just added a field to the feature service and calculated over the child's global ID. Since it's 1:1 this shouldn't cause any issues. Now I just feed the URL globalId={ChildID} and it does the job just fine. 

Thanks for your help, though! The engagement is appreciated. 

DougBrowning
MVP Esteemed Contributor

Ok so it was the child i think.  Note to make it dynamic you can use arcade to go get the child id,

like this then send this arcade in the url.

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