Hi there,
is it possible to create multiple records in a related table without creating a new parent record?
This is my scenario:
I have a couple of static polygons (small sites). These sites need to be audited every day. These audits are stored in a related table. In the past, I solved this by requiring the user to submit multiple surveys each day. (This was done via the submission_url = the FeatureService and instance_name = the related table)
Now, there should be a change, and only one survey that caters to all sites within one go should do the same. So basically a repeat. The user opens the survey and does the first site, clicks plus, does the second site, clicks plus, does the third site and so on…
However, using a repeat also creates a new parent feature which I don't want to have. There should still be the same static sites, and only the related table should get updated.
Is there a way to achieve this?
A site note which might be relevant for this: There are two relationships. One is based on the site name, and the second one is based on GlobalID/ParentGlobalID. Using the submission URL method, I’m getting the error message that I have an Unsupported relationship type esriFieldTypeString in key SiteName for table SiteName
Solved! Go to Solution.
Well then you do need some kind of parent for that to work. You could make a dummy parent layer as some have done. I thought you meant one form = one repeat. One cannot just have the repeats go and not the parent. But if they are at a different site I would think you would want a diff form to capture all the dates and location. We always collect location so we can easily see if they went to the wrong place.
You can also look at using inbox. Some like that workflow but I do not. Up to you.
You could point the form directly at the related table skipping the parent totally. This may need to be a diff form than the first one if you need the parent fields for some reason. Or point all of them to the repeat table if you dont. Since you have your own relationship class you can add that key and leave parentglobalid blank (I think).
I hope that makes sense.
Thank you Doug,
I think I'm not quite following you. 🤔
I only have the repeat left in my form.
However, looking in the schema I can see that the parent feature layer is still there:
If I now submit a survey, a new parent feature will still be created (a blank one, with no geometry)
Did you create it from a service? That is my guess. So it brought all of it.
You would take all the parent stuff out and have just the SiteAudit part in the form. We do this a lot.
I hope that makes more sense.
Thanks again @DougBrowning, I much appreciate your help here.
I think we are getting a bit closer.
So, I created the survey from scratch (more or less) and pointed the survey to the existing related table (form_id=SiteAudit, instance name = 1, submission URL = feature service URL).
The schema stills shows two layers/tables. (both with the same name). Anyway, I tried to publish the Survey, but now receive the error message (Unsupported relationship type esriFieldTypeString in key SiteName for table SiteName) I think I saw a comment from you somewhere saying that for a Repeat you must have a relationship class between GlobalID and ParentGlobalID. Is this correct?
EDIT:
I have now added a second relationship (GlobalID and parentglobalid), but I'm still getting the error message above
"relationships" : [
{
"id" : 0,
"name" : "SiteAudit",
"relatedTableId" : 1,
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleOrigin",
"keyField" : "Name",
"composite" : false
},
{
"id" : 1,
"name" : "SiteAudit",
"relatedTableId" : 1,
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleOrigin",
"keyField" : "GlobalID",
"composite" : false
}
],
...
...
"relationships" : [
{
"id" : 0,
"name" : "Sites",
"relatedTableId" : 0,
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleDestination",
"keyField" : "SiteName",
"composite" : false
},
{
"id" : 1,
"name" : "Sites",
"relatedTableId" : 0,
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleDestination",
"keyField" : "parentglobalid",
"composite" : false
}
],
Can you post the form it sounds like you still have a repeat in there. You should not need the globalid one if you are creating children.
Hi @DougBrowning, yes, I do have a repeat in there. But that's what I want to have, right?
I want to give the field worker the opportunity to collect multiple records (different sites) within one survey (without the need of sending them individually and starting a new one)
Well then you do need some kind of parent for that to work. You could make a dummy parent layer as some have done. I thought you meant one form = one repeat. One cannot just have the repeats go and not the parent. But if they are at a different site I would think you would want a diff form to capture all the dates and location. We always collect location so we can easily see if they went to the wrong place.
You can also look at using inbox. Some like that workflow but I do not. Up to you.
Thanks Doug, this is exactly what I did. I have one dummy parent that cotaints the parentid, one site (not included in the survey) and one audit table that has two relations (one to the dummy parent, and one to the sites).
I think thats the closest I can get 🙂
Good morning,
I did a video on this the other day that might answer your polygon question via Survey123
If you need more help, I have office hours Wednesday evenings at 6 pm PST.