Select to view content in your preferred language

Changing spaces to underscores in a survey

478
1
08-05-2024 08:58 AM
SteveBrewer
Occasional Contributor

In my survey I have a Survey ID field that acts as an intelligible globalID so that we can keep track of data using repeats and is built on a set of questions at beginning of the survey. An example is (Drill/Spill/Training)_(Location)_(Initials)_(Date)_(Time) or 

concat( ${d_s}, "_", ${inc_loc}, "_", ${initials}, "_", format-date(${surv_date}, '%Y%m%d'), "_", format-date(${start_time},'%H%M%S'))

Is there a way in the XLS form I can make it so that if the location has a "space" character it is re-written as an underscore? Or is that something we would have to fix in post processing?

0 Kudos
1 Reply
abureaux
MVP Frequent Contributor

By default, no, you cannot replace characters via XLSForm.

However, this could be completed via JavaScript within your survey. There are some limitations to java, so if that doesn't work for your survey, you will need to do this via post-processing.

0 Kudos