Hi All,
I am working on building a Survey123 form where I am populating 14 fields from a single bar code scan. I know which string numbers correlates to which field, for example the ‘model’ field is characters 0-19 and can parse the data accordingly. In reality, the ‘model’ value will always be between 8 -12 characters long, never filling the 20 character spaces allotted for it within the bar code, therefore leaving white space at the end of the data entry. I would like to remove the whitespace after the entry and am trying to use the trim() Java script function. I have practically zero Java experience but have watched a handful of the Survey123 and Java YouTube videos. This is what my script looks like below and it does work when testing it:
When I copy the java script into my excel form and try to save it, it looks like this:
I am trying to parse the data and trim the blank space in the same calculation cell and get the following error:
“There has been a problem trying to replace ${<model>} with the XPath to the survey element named ‘<model>’. There is no survey element with this name.”
I try to create a calculate row with the Java script in it as pictured below and get the same error message.
I am pretty stuck here trying to figure out how to trim/get rid of the white space and any help would be greatly appreciated!
Thank you very much,
Zach
Anyone have any ideas? Any advice would be appreciated.
Thanks!