ODK-X character limits

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?

You can try using the type "text" instead of "string"

2 Likes

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 of this in the app-designer repo.

Clarice

3 Likes

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?

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-reference/#custom-prompt-types

BreathCounterExample:

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

1 Like

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.

1 Like