when a <return> is used in a text field in survey123, the subsequent multi-line text appears to be "missing" in the attribute table

2601
12
02-01-2019 10:09 AM
LynnBerni
Occasional Contributor II

While editing data (submitted via Survey123) in ArcDesktop the other day, we noticed that information was missing in some of the text fields. But then realized it was there, but not visible because it had been entered with a <return> on the ipad.

Here's what it looks like in the attribute table:

When selected during an editing session, the additional text (after the break) is revealed:

Further investigation revealed that the note was entered in S123 like so:

Intensive

FB-7:18

Is there a way to prevent this?  Maybe a way to convert the <return> to a "space" when the survey is submitted?

Please advise, thanks!

Lynn

12 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Lynn,

There isn't a method to replace the values at the time of form submission.  You can run a geoprocessing operation to update the fields.  You would use the Calculate Field—Help | ArcGIS Desktop tool with an operation (Python) like:

!FIELD!.replace("\n", " - ")

or similar; I'd recommend testing on a copy first.

by Anonymous User
Not applicable

Hey James,

Could you do an if() statement that would use the old find and replace of the character map of a hard return "Alt"+010; maybe something like if((contains(${question}, 'ALT+010'),' ','')? Guessing probably not.

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Mike,

That wouldn't work - first, you would want to use a regex pattern for the return vs. a character specification and second, the statement you have would cause the entire question to be replaced with a space.  There isn't a replace equivalent in the XLSform specification.

JoeBorgione
MVP Emeritus

James Tedrick‌ - I've been sparring with this issue for Lynn since yesterday and have been spinning my wheels.  (See: Where clause for '\n')

Your calculation suggestion works nicely if you manually make a selection on the offending records and perform it with the field calculator.  I've been trying to perform it behind the scenes with a search cursor, select, calculation and an update cursor to no avail.  Any suggestions for such an approach?

That should just about do it....
0 Kudos
JamesTedrick
Esri Esteemed Contributor

My thought was to simply run the calculate field GP tool on the feature class, without a selection or search cursor - it will do a bulk search & replace on the field.

0 Kudos
JoeBorgione
MVP Emeritus

Yep, I get your point, however  Lynn has a number of tables where the newline phenomenon is present.  I've created a couple of python scripts that perform some data edits and run as scheduled tasks after hours (after the field data has been synced to the egdb).  She's hoping to get the newline thing corrected in one of those tasks....

That should just about do it....
0 Kudos
JamesTedrick
Esri Esteemed Contributor

That should be possible - all the GP tools are available in arcpy.  The one issue would be if there are situations where you would want a newline character in the entry of some records but not others in the same field; then you would need a selection set based on the inclusion/exclusion criteria.

0 Kudos
JoeBorgione
MVP Emeritus

It should be, I just haven't figure it out....

That should just about do it....
0 Kudos
LynnBerni
Occasional Contributor II

James Tedrick‌ this post from last january has a similar question (I think), Multi-line text fields not showing up on Survey123 print.  Your comment mentioned a bug fix for the Survey123 website. Is this relevant?

0 Kudos