Survey 123 failed to submit incorrect syntax near the keyword 'WHERE'.

280
8
12-19-2019 10:51 AM
Highlighted
New Contributor III

Survey 123 Submit Error

Survey writes to an existing feature service with a related table.  Had an earlier version working and then made a cleaned up version of the feature service and now I get this error.  Any ideas?  I've attached the survey form.

Also, is it possible to pass in data to fields inside a repeat?  

Reply
0 Kudos
8 Replies
Highlighted
Esri Esteemed Contributor

Hi Tim,

I don't see anything that stands out as being off in your form and test submission when published to a new feature service works correctly.  One thing that looks unusual in the form settings is the submission_url - it has a /2 at the end of it.  When you go to the form's Item Details page, do you see the link to the layer (and does it work correctly)?

Reply
0 Kudos
Highlighted
New Contributor III

Hey James,

Thanks for the response!  The "/2" at the end of the submission URL was my attempt at getting it to write just to the table in feature layer.  Adding it, removing it, changing it, doesn't seem to affect anything.  The feature service that the survey is writing to  is in the form's item detail page and it links correctly.  

I should have mentioned, the link I'm using to open the survey is 

https://survey123.arcgis.com/share/c90196b0f27e4d0dbff1395ce87185ac?mode=edit&objectId={objectID}&ce... 

That's where I get the submission error.  I'm wondering if maybe using the "mode=edit" might be the issue?

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Tim,

The /2 is not the way to set the appropriate table - the form_id ('UndergroundStorageTanks') setting is.  Just to check, if you are editing an existing record, does it load correctly in the form (the error appears to occur on submission, not load)?  Is there a reason you are passing the point location (wouldn't that already be in the record)?

Reply
0 Kudos
Highlighted
New Contributor III

So I'm trying to add records to a related table.  The /2 was an attempt to call to that table's ID in the feature service.  When I've changed the form_id to the table's name, I also get an error.  The point location doesn't need to be passed in either.  But I've just been throwing everything at it to see what happens.  I've tried both having that in there and not having it in there and it doesn't seem to make a difference.

I just can't seem to figure out this submission error at all though.

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Tim,

The form you are working with has both a parent layer ('UndergroundStorageTanks') and a repeat (related table) section ('UST_Inspection').  Are you wanting to add new records to the UST_Inspection section?  If so, you might be better served with a form that targets only that layer and open it to create a new record.  Part of that form design would be including the field that is the parent key as a hidden field passed via URL (or perhaps selected from a drop down).

Speaking of the parent key field, is it by chance Tank_ID?  I see that in your form as a hidden question with a null esriFieldType.  That might be causing the error you are seeing if you are specifying it to be null.

Reply
0 Kudos
Highlighted
New Contributor III

Yes, that is exactly what I was trying to accomplish!  Every time I tried to pass the parent guid {GlobalID} into the relation field {Tank_ID} it wouldn't do it and kept creating a new point in the parent layer (UndergroundStorageTanks).  

Basically what I'd like to do is have certain fields from UndergroundStorageTanks populate fields in the related table UST_Inspections.  How do I go about focusing the survey form on just the UST_Inspection table?  

Will this URL work?

https://survey123.arcgis.com/share/c90196b0f27e4d0dbff1395ce87185ac?&field:Tank_ID={GlobalID}&field:.......so on and so forth?

And do I keep everything inside a repeat?

Reply
0 Kudos
Highlighted
Esri Esteemed Contributor

Hi Tim,

The other aspect is that I would be reluctant to pass a value into repeat (which gets back to a question in your first comment).  You may be able to get it to pass using the repeat/table name as part of the field name, but a dedicated form would be much better.  You can start that by

1) Removing the questions outside the repeat (you can keep them if you give them null field type values

2) remove the begin repeat / end repeat lines

3) Change form_id to the repeat table (UST_Inspections)

4) Include the parent key field (parentglobalid/tank_id/?).  As mentioned above, this could be a hidden field loaded by URL parameter or a select_one with a dropdown/autocomplete.

Highlighted
New Contributor III

James, I can't tell you how long I've been banging my head against a wall to get this to work and you just got me over the hurdle! 

Thank you so much!

Reply
0 Kudos