# Trim Function in Survey123

329
1
09-27-2018 12:57 PM
Highlighted
Occasional Contributor III

Is it possible to use the trim function or some other method to remove unwanted spaces due to a concatenate in Survey123?  The idea is if an field can be parsed it should be parsed from the start.  Address example 100 S Vine Ave.  100 would be in one field, S in another, and so on.  However, to run that address against a single field geocoder or even used in a form letter for a mailing (like Dear resident at 100 S Vine Ave), I need it in a single field.  When concatenated and lets say the directionality is not part of the street name (100 Vine Ave), you would get extra space so 100--Vine-Ave instead of 100-Vine-Ave

trim((\${houseno_txt})+ " " + (\${stdirectionnospace_txt}) + " " + (\${street_txt}) + " " + (\${streettype_txt})) doesn't work, and =trim((\${houseno_txt})+ " " + (\${stdirectionnospace_txt}) + " " + (\${street_txt}) + " " + (\${streettype_txt})) gives an error from a formula stand point.

Any suggestions?

Tags (3)
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor III

Figured one way out:

``if(\${stdirection_so}= "None", '', ' ' + \${stdirection_so})‍``

in the field that returns the direction followed by

``concat(\${houseno_txt}+ \${stdirectionnospace_txt} + ' ' +  \${street_txt} + ' ' + \${streettype_txt})‍‍``

in the field that generates the results.

``if(\${stdirection_so}= "None", '', ' ' + \${stdirection_so})‍``
``concat(\${houseno_txt}+ \${stdirectionnospace_txt} + ' ' +  \${street_txt} + ' ' + \${streettype_txt})‍‍``