# ODK-X character limits

**URL:** <https://forum.odk-x.org/t/odk-x-character-limits/532>\
**Category:** Support\
**Created:** [July 17, 2019, 8:17pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532 "2019-07-17T20:17:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CharlieM](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/charliem/32/37_2.png) [@CharlieM](https://forum.odk-x.org/u/CharlieM)\
**Post date:** [July 17, 2019, 8:17pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/1 "2019-07-17T20:17:10Z")

</div>

Hi,

I am using ODK-X survey, tables and sync endpoint. Whenever I attempt to synchronize a row which contains a string longer than 255 characters, I get an error message -  
_A communication error occured_  
_Protocol Error. Please verify that the server and device are compatible_

I am certain this error is due to the number of characters as I can synchronize fine when the field contains exactly 255 characters. Is there any way I can increase this character limit?

---

<div class="post-metadata">

**Author:** ![W\_Brunette](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/w_brunette/32/376_2.png) [@W\_Brunette](https://forum.odk-x.org/u/W_Brunette)\
**Post date:** [July 17, 2019, 8:50pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/2 "2019-07-17T20:50:54Z")

</div>

You can try using the type “text” instead of “string”

---

<div class="post-metadata">

**Author:** ![clarice\_larson](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/clarice_larson/32/293_2.png) [@clarice\_larson](https://forum.odk-x.org/u/clarice_larson)\
**Post date:** [July 17, 2019, 11:27pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/3 "2019-07-17T23:27:11Z")

</div>

Strings are limited to 255 characters by default. To increase the length for a string in Survey, you could add a model sheet to your xlsx workbook and set the elementType to be string(\<string\_length\>). For example, if you had a string prompt named long\_data that you wanted to be 500 characters, you would add the following to your model worksheet.

| name | type | elementType |
| long\_data | string | string(500) |

We also have an [example](https://github.com/opendatakit/app-designer/blob/master/app/config/tables/datatypes/forms/datatypes/datatypes.xlsx) of this in the app-designer repo.

Clarice

---

<div class="post-metadata">

**Author:** ![CharlieM](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/charliem/32/37_2.png) [@CharlieM](https://forum.odk-x.org/u/CharlieM)\
**Post date:** [August 6, 2019, 10:27am UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/4 "2019-08-06T10:27:15Z")

</div>

Hi @clarice_larson and @W_Brunette, thanks for your help.

It seems to me that the text type is just another name for the string type - and the xlsx converter changes text types to string types.

Using elementType works great for strings up to about 60,000 characters long. Any larger than this, and I get _Internal Server Error (500)_ when I try to reset the app server.

We require strings around 1,000,000 characters long. Is there any way to achieve this?

---

<div class="post-metadata">

**Author:** ![W\_Brunette](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/w_brunette/32/376_2.png) [@W\_Brunette](https://forum.odk-x.org/u/W_Brunette)\
**Post date:** [August 15, 2019, 11:49pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/5 "2019-08-15T23:49:42Z")

</div>

I have a suggestion that should work in the short term without changes to the core. You can create a custom prompt type that inputs into a binary so it will be saved as a text file.

Here are some links that might be helpful:  
[https://docs.opendatakit.org/odk-x/xlsx-converter-using/#customizing-prompts](https://docs.opendatakit.org/odk-x/xlsx-converter-using/#customizing-prompts)

[https://docs.opendatakit.org/odk-x/xlsx-converter-reference/#custom-prompt-types](https://docs.opendatakit.org/odk-x/xlsx-converter-reference/#custom-prompt-types)

_BreathCounterExample:_

> **[app-designer/app/config/tables/breathcounter/forms/breathcounter at master ·...](https://github.com/odk-x/app-designer/tree/master/app/config/tables/breathcounter/forms/breathcounter)**
>
> master/app/config/tables/breathcounter/forms/breathcounter

_IMNCI_ (has breath counter as well as pulseox being handled custom)

> **[app-designer/app/config/tables/imnci/forms/imnci\_test at master ·...](https://github.com/odk-x/app-designer/tree/master/app/config/tables/imnci/forms/imnci_test)**
>
> master/app/config/tables/imnci/forms/imnci\_test

---

<div class="post-metadata">

**Author:** ![clarice\_larson](https://odkx.b-cdn.net/user_avatar/forum.odk-x.org/clarice_larson/32/293_2.png) [@clarice\_larson](https://forum.odk-x.org/u/clarice_larson)\
**Post date:** [August 16, 2019, 7:07pm UTC](https://forum.odk-x.org/t/odk-x-character-limits/532/6 "2019-08-16T19:07:05Z")

</div>

Without a change to the core, another thing that you could try is to use a session variable to get the 1,000,000 characters and then split the string into chunks that are assigned to different text fields stored in the database. Then you could concatenate the fields when you need to for example display the data.
