Survey123 feature class as a related table

37000
87
Jump to solution
08-22-2016 09:43 PM
GordonSumerling
Esri Contributor

Hello All,

I need to understand how it might be possible for my Survey123 feature class to be a related table to a polygon feature in the map.

In essence I have a farm field feature class and I want to perform an inspection against this. Conventionally, I would create a feature class to represent the farm in ArcMap and then create a related feature class in ArcGIS that is the inspection feature class. Now I could use this in collector. However, I want to take advantage of the field manipulation capability of Survey123. 

The inspector already knows the farm ID so he just needs to perform the inspection with survey123. So the question is how do I publish the survey123 feature class and then relate it to the farm polygon feature class in ArcGIS Online?

Cheers

Gordon

87 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Yukun,

It sounds like the ParentID field in the table is misconfigured and is set as non-editable.

0 Kudos
YukunXing
New Contributor III

Thanks for the quick response James. I don't know how to make it editable - unlike other fields there is no checkbox for this field I can play with. Not sure whether I missed something, or because it is the foreign key of the related table (which I guess is necessary for the relationship class).

0 Kudos
JamesTedrick
Esri Esteemed Contributor

The fact that it's a foreign key of a record shouldn't make the field non-editable.  How are you creating the feature class, table and relationship?

0 Kudos
YukunXing
New Contributor III

James, please see "Details" in my post at the very bottom of this thread - I was trying to cover more questions after I posted my original question to Chris' post, just before you responded to me. Sorry for the double post!

0 Kudos
ColinCampbell
Occasional Contributor

Hi James,

Thanks for all of your replies - they've been really helpful.  I still had some problems with the curly braces so I thought I might post how I got around them. I'm not sure if it's a wider problem or just me, but just in case it helps someone.

My scenario is very similar to the ones previously mentioned - I have a feature layer of visit areas related to a separate table of inspections.  The visit areas are recorded using Collector (or through a web map app when being accessed on a desktop) and the inspections using Survey123 (or Survey123 for ArcGIS on a desktop) the two being linked, as above, with the custom URL passing the GlobalId from the feature layer to the a ParentGlobalId GUID field of the inspection table. 

Everything worked fine between Collector/the web map app and Survey123, there were no curly braces being passed across with the GlobalId and the relationship between the two record types was being formed as hoped.

The problems only started happening once the user downloaded the map in Collector so they could work offline (rather than running live off the network).  When this happened Collector started putting in the braces, which, as mentioned previously, prevents the link between records being established.

For my workflow I needed users to be able to add records using Collector when connected to the internet, using Collector when there was no connection and on a desktop.  If I used the above suggested work-around of removing the first and last character of the incoming GlobalId, it solves the problem for the offline Collector route - it removes the { and }. However for the other two routes - which don't have braces in the GlobalId - it cuts of the first and last digits of the actual GlobalId. So not really ideal.

To get around it I took the ‘substr(${incoming}, 1, string-length(${incoming}) - 1)’ function and added an ‘if’ statement according to the length of the GlobalId value (which should be 36 characters in length, but is 38 when the braces are present), getting the following:

if(string-length(${incoming})>36,substr(${incoming}, 1, string-length(${incoming}) - 1),${incoming})

Using this calculation in another field on my Survey123 form and passing the results to the ParentGlobalId field in the inspections table seems to have done the trick.

0 Kudos
ChrisGoessl
New Contributor III

This works but I needed to change one of the fields for the incoming GlobalID to be processed. I have "ParentIDOrig" as the incoming GlobalID from the Collector Application. In the XLS file, you will need to change the blind::esri::fieldType to "null".

In the ParentID field (this is the field that is related back to the Feature Class) I placed the following into the calculation field: 

if(string-length(${ParentIDOrig})>36,substr(${ParentIDOrig}, 1, string-length(${ParentIDOrig}) - 1),${ParentIDOrig})

The by placing "null" into the 'blind::esri::fieldType'  the GlobalID that has the {} will not be pushed back into the table once the data is added to Survey123.

Hopefully this makes sense.

Chris

 

0 Kudos
RobertWeber
New Contributor III

You two are doing the same exact thing no?

0 Kudos
WASHSECTOR
New Contributor II

Hi, Hope this message finds you well.
I have a question: It is possible to collect data using survey 123 for missing field in hosted feature layer.
Below an example:
I have a hosted feature layer having some data collected using survey 123. the first 10 fields were filled.
After a while, i need to do another assessment for the same site. I added the fields (6 new questions) in the hosted feature layer and submission url. now i can do the new assessment (and fill the new 6 fields) but only from the inbox.
What i am asking is to collect new  submission and according to a field (e.g. pcode) inside the assessment the data will be filled in the correct record. 
Thank you,
waiting your reply.

0 Kudos
KauaYoung
New Contributor

Hello,

This thread has been helpful, but unfortunately, I'm still having problems. I cannot get my GlobalID to pass from Explorer to Survey123. 

arcgis-survey123://?itemID=1acf8de6b4f94b53a8db3c2f00ae42c1&field:PUC_Maximo={PUC_Maximo}&field:parentglobalid1={GlobalID}

I've tested this link with arcgis-survey123://?itemID=1acf8de6b4f94b53a8db3c2f00ae42c1&field:PUC_Maximo={PUC_Maximo}&field:parentglobalid1={PUC_Maximo}, and that works.

I created the survey from a Feature Class and it is the related table. In the map, I have a pop-up that when you click, takes you to the survey. The survey will save and upload, but like people mentioned above, I am left with orphaned records.

I have a row called "parentglobalid1" in my survey that takes in a text question and then I parse it with the code I found above and save it as a GUID type.

if(string-length(${parentglobalid1})>36,substr(${parentglobalid1}, 1, string-length(${parentglobalid1}) - 1),${parentglobalid1})

The only problem is nothing is populating the parentglobalid1 row from the link.

I'm also open to using the pulldata() function, but cannot figure out how to write that code when I don't have a csv file.

Thank you!

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Kaua,

It might be helpful to generate an http url with your parameters to see how the field values look.  Also to check, this feature service already existed, correct- Survey123 published layers normally don't have parentglobalid1 as a field name.

0 Kudos