Select to view content in your preferred language

Restrict cascade deletes from child to parent table

440
5
Jump to solution
07-25-2024 08:01 AM
PTOOffice
Emerging Contributor

I'll set up the scenario. I built a survey123 form using connect that collects school bus accident data. Accidents have a 1 to many relationship. Since a bus can hit multiple vehicles, the form is set up as a repeat in the form.  The main form table is called accident and the bus specific data on a repeat is called rptBus. The accident table has the parent ID and rptBus table has the childID.

I had a situation where a user submitted a form, but then modified the submitted record. Because the settings weren't correct, when they corrected data it put a duplicate bus record in the rptBus table. No big deal I thought, I'll just delete that row. However, it deleted the parent row from the accident table. I was NOT expecting that behavior.

My question is, can I stop cascading deletes from the child table (rptBus) to the parent table (accident)? I want cascading deletes from the primary accident table to delete to the child table, but NOT the other way around.

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

Ah, no. I hadn't yet gotten into the GIS field back then.

Yes, I would create the tables in Pro, then create the relationship class, then publish it. In Connect, you can create a survey from an existing Feature Service, so do that and just point it at the newly-published layer.

- Josh Carlson
Kendall County GIS

View solution in original post

0 Kudos
5 Replies
jcarlson
MVP Esteemed Contributor

You can, but it's something you have to set up when you initially create the relationship between layers. If the layer is published directly from S123 Connect, I don't know how that works or if you're able to see that setting, but I'd suggest creating and publishing the layer in Pro. That way you can see and adjust the "composite" relationship setting.

- Josh Carlson
Kendall County GIS
PTOOffice
Emerging Contributor

Those tables (and the associated relationship) are created automatically when creating a form in Survey123. If I'm understanding, you believe I can alter this behavior using pro and bringing the tables in individually.

On a side note, I used to work for La Salle County from 2006 to 2009. I don't remember if you were at Kendall County at that time, but if so, I believe we've met.

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Ah, no. I hadn't yet gotten into the GIS field back then.

Yes, I would create the tables in Pro, then create the relationship class, then publish it. In Connect, you can create a survey from an existing Feature Service, so do that and just point it at the newly-published layer.

- Josh Carlson
Kendall County GIS
0 Kudos
PTOOffice
Emerging Contributor

Oh man, I wish I would have known I can create a survey from existing feature services. I think I'll make a copy of my form and then do what you are suggesting. 

Thanks for your help. BTW, who was your predecessor? 

Thanks again!

Doug Kampe

0 Kudos
jcarlson
MVP Esteemed Contributor

I was preceded by Don, Chris, and Jonathan. Maybe Jeri, depending on how long ago it was. They've all since left.

- Josh Carlson
Kendall County GIS
0 Kudos