Error message when trying to edit data (invalid string length)

Hello, I’ve just tried to edit a form on Kobo and I got an error message, saying “RangeError: Invalid string length” and advising me to contact you to resolve it. I was trying to edit this form:
KoboToolbox)
I’d be very grateful for any help or advice on how I can resolve this issue and edit the form, thank you!

Hi @AnnaM, can you share the screen shot of the error and share the xls version of the form? Because we can’t access your forms

1 Like

Hi, here’s the error message:

Can you share rhe XLS version of the form? It is probably caused by a mistake in your form

1 Like

I was able to replicate the mistake you got and here is your problem, so created a integer question “How many species of trees have been planted?” and used it as repeat_count for the question “Informations on trees planted”. Till this point there is no problem, but the problem starts when you enter 38300 to “How many species of trees have been planted?” this is way over the repeat function can handle. I believe you added the repeat question later or there was a mistake with the skip logic so the repeat question did not appeared during the data collection. So when you solve the mistake and try to edit the form, kobo tries to add 38300 repeat question which is impossible to handle. The solution you need to re-design your form.

image

2 Likes

Thanks so much- yes the 38,300 is one of the things I was trying to edit as it’s an error! I’m trying to change it to 3 and then add the details of the individual species counts etc. Do you think that will be possible, or do I need to delete this form, make all the changes outside of kobo, and then collect the data again? Sorry for all the questions!

I just tested and confirmed, you can change the 38300 value by using the API. Watch the video and apply the steps till 1:37, Use the link below instead of the one i provided in the video, when i made the video url was different.

Instead of the value in the video use the one below, it will directly change a specific submissions, specific value. Replace the submission id with the submission you would like change, you can find the “_id” value under the data tab, it is in the end of the table as “_id”. copy the value and paste it to code below, and you can replace the “3” with any value you would like to replace the current value. In the end it looks like something in the image below.

If it the request return “200 OK” that means it was successful. Let me know if you need more help

  {
      "submission_ids": ["648485946"],
      "data": {
          "NbSpecies":"3"
      }
   }
https://eu.kobotoolbox.org/api/v2/assets/{your formid}/data/bulk/

2 Likes

That’s wonderful- thanks so much!

1 Like