Survey123 working with a table that is in a AGOL service with a related featureLayer

2126
7
04-12-2017 07:37 AM
NickToscano
New Contributor II

I have a service in AGOL that has a FeatureLayer and a Table.

I took the time to make the table have ID:0 and the FeatureLayer is ID:1.

Regardless when I point Survey123 at my service it only wants to write to the FeatureLayer and not the table.

How do I get it to write to the table? I need both the featureLayer and the table in the service becasue they have a relationship set up. 

0 Kudos
7 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Nick,

You need to specify the table you wish to write to by providing the layer's name in the form_id entry in the settings workbook.

0 Kudos
SamEdwards2
New Contributor

How did you make the table have ID:0 and the FeatureLayer is ID:1?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Sam,

When publishing via desktop, you can have the IDs set to specific values, rather than automatically assigned:

Map authoring considerations—Documentation | ArcGIS Enterprise 

0 Kudos
SamEdwards2
New Contributor

Thanks for this info. 

So I had success in that was able to publish a line layer (Pipes) with a related table to AGOL, with the table ID = 0 and the Pipes ID = 1 (which then allowed me to add the service URL as the submission URL in my s123 form, and submit data from s123 to the table. 

Thinking I was in the clear, I am now finding that when I publish the Pipes/table feature service (4 pipes in the line feature class, and no records in the table), for whatever reason, the 4 pipes disappear once on AGOL - no geometries display, nor are there any features in the pipes attribute table. WHY?

In a webmap, I am able to add pipes to the layer, but for whatever reason, when I publish from desktop to AGOL, it somehow loses my existing pipes. Perhaps has something to do with changing the IDs around?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Sam,

On the display in the ArcGIS Online, I do not know the issue involved with this- it would be best to raise that in their groups.  That being said, I'm not sure why the reordering of the layers is necessary.  Survey123 can write to a table even if it's layer id isn't 0 - the table name needs to be specified in the form_ID entry in the settings worksheet.

0 Kudos
SamEdwards2
New Contributor

I did not reorder the IDs initially (Pipes ID = 0 and the table ID = 1), and I could not get s123 to publish the survey. Again, I published a pipes layer and a related table to AGOL, and below is a snip from that Feature Service's URL...

http://services.arcgis.com/0hWR1h1PHFoPztOo/arcgis/rest/services/surl_pipes0/FeatureServer 

So, in an effort to populate a submission URL specifically for the related table, I used the following URL (note the "/1" at the end to point directly to the table, and not the pipes):

http://services.arcgis.com/0hWR1h1PHFoPztOo/ArcGIS/rest/services/surl_pipes0/FeatureServer/1 

The following is the result when trying to publish my survey:

My next thought was that adding the "/1" is what is fouling things up, so I replaced the above submission URL with the following (simply excluded the "/1"):

http://services.arcgis.com/0hWR1h1PHFoPztOo/ArcGIS/rest/services/surl_pipes0/FeatureServer 

As a result, I was able to publish the survey, but when trying to submit a survey, I get the following error:

This led me to believe that  by using this URL (http://services.arcgis.com/0hWR1h1PHFoPztOo/ArcGIS/rest/services/surl_pipes0/FeatureServer) and not specifying a layer ID at the end, s123 looks at whatever layer in the feature service has an ID of 0 (in this case, the pipes), hence "incorrect geometry" error.

So, that is why I tried switching the IDs around so the table is 0 and the pipes 1 when publishing the feature service, thinking a submission URL requires no "/#" appended to the end. And like I said before, doing this allowed me to publish the survey and submit data, but when publishing the pipes/table feature service, I lose the features in my pipes  on AGOL.

Maybe I am going bout this all wrong - I'm sure there is a way to populate the submission URL to write to a table regardless of its ID, but what am I doing wrong? How can I populate the submission URL with a valid URL that points directly to my related table that has an ID of 1, or any number for that matter?

Thanks for your responses thus far, I'm really hoping I can get this to work as I foresee a large time-savings by submitting survey data to a table that has a relationship already in place with the pipes layer.

Sam

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Yes, there is a way to specify which layer the form is writing to - specify the name of the layer in the form_id entry of the Settings tab in the XLS file.  For example, looking at this service:

A form targeting the table only has this setting:

0 Kudos