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

857
12
02-01-2019 10:09 AM
Highlighted
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

Reply
0 Kudos
12 Replies
Highlighted
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.

Highlighted
Regular Contributor

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.

Reply
0 Kudos
Highlighted
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.

Highlighted
MVP Esteemed Contributor

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?

Reply
0 Kudos
Highlighted
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.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

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....

Reply
0 Kudos
Highlighted
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.

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

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

Reply
0 Kudos
Highlighted
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?

Reply
0 Kudos