Send Error - String or Binary Data would be Truncated

1697
6
Jump to solution
02-16-2021 10:25 AM
ChrisMaclaurin
New Contributor III

Hi All,

I am struggling to get one of my surveys to work properly, all seems to be ok but I can't seem to submit when I add the Javascript that brings back some data, checks against another parameter and then returns a value into the form. It all seems to work ok in connect, and also in the field form but then fails to submit 'String or Binary Data would be Truncated'.

As the code seems to work ok I am wondering what is going on, it is a new survey and hosted layer so I fail to think the JSON file is to big? Perhaps there is an error I am not seeing? Please if anyone has any ideas or could help?

Thanks

Chris

 

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

My guess is it is the token field since that is huge.  You prob do not want to store that token right?  If not set esri bind type to null and then it will not send it to AGOL.  If you do want it then set that to a large string size also.

Hope that helps.

View solution in original post

6 Replies
DougBrowning
MVP Esteemed Contributor

This usually means you are trying to put data that is too big into a field.  Which field it is it must be returning something too large for it.  You can up the size of a string using the bind Esri field length column.  

It could also be the wrong data type.  It may be returning a 1 element array and not text like you think.  What does it look like in the display?

Hope that helps.

0 Kudos
ChrisMaclaurin
New Contributor III

Here is the survey as it appears on the screen... as far as I know it is a one element array! (or at least that's how I was treating it in the jscript!

File 16-02-2021, 19 44 33.png
The issue is the note..."Last Stop Reference Recorded" This is the info the Javascript gets from the hosted feature layer denoted by the script attached in the first post. I know the rest of the survey works ok as I took out the Script and the two rows from the xls form....

pulldata("@property","token")
pulldata("@javascript", "functions.js", "getStopRef", ${token}, ${Saltmarsh})

.. and it submitted ok without that.

I have also attached the info from what i call the 'instance window' when pressing the submission on connect (if that is any help)!

The pulldata("@javascript"...) was set to esriFieldTypeString and field length of 4000. I tried removing these to see what would happen but it still didn't work.

I am a bit lost what to do now?

0 Kudos
DougBrowning
MVP Esteemed Contributor

My guess is it is the token field since that is huge.  You prob do not want to store that token right?  If not set esri bind type to null and then it will not send it to AGOL.  If you do want it then set that to a large string size also.

Hope that helps.

ChrisMaclaurin
New Contributor III

Thanks Doug, you were spot on! Looks like the length of the token tripped it. I also didn't know about the null value in the Bind::esri:fieldType. not sending to AGOL. that'll be a handy bit of info. Your help is much appreciated as always.Cheers.

MattReeves_SpokaneValley
New Contributor III

Hi Doug,

I am getting this exact error as well, but my survey was developed in the web version of Survey123. Not in Survey123 Connect.  Do you have any suggestions on how I can find this token field in the web version? I did not see it in the Schema.

Cancel my request Doug, I figured out that one of the coded values for a Yes No Dropdown was still set to 'Choice 3' which was longer than the 5 characters allowed for the field.

Thanks,

Matt

 

Matt Reeves
0 Kudos
DougBrowning
MVP Esteemed Contributor

Never used the web version sorry.  You could try changing it on the data service directly.  It may let you.

0 Kudos