Workaround that prevents embedded data fields from trimming leading or trailing spaces? Or allows me to define a single space as the value of an embedded data field? | XM Community
Skip to main content

I have a survey question that asks about respondents' process for choosing an MBA program. Some respondents have already chosen a program, and others are still considering. I need to vary the verb tense of the response options accordingly: for example, some people should see "I thoroughly researched programs," and others should see "I have thoroughly researched programs." (The difference is whether the word "have" is there or not.) I want to create am embedded data field, HaveOrSpace, that contains a value of "have " note the trailing space] or just " " ONLY a space]. Then, I could pipe that into my response option like this: "I ${e://Field/HaveOrSpace}thoroughly researched programs." The problem is that when I try to define values for that embedded data field, the spaces aren't preserved: any leading/trailing spaces, or spaces all alone, appear to be automatically trimmed when I try to define values for an embedded data field in the survey flow. Does anyone have a suggestion for how to accomplish the same goal?

And by the way, I thought about defining HaveOrSpace is just "have" no trailing space] for one group and leaving it blank for the other. But the problem there is that the group that should only see past tense--the group that already made their EMBA program decision and should see "I thoroughly researched programs"--will now have a double space between "I" and "thoroughly", which looks very sloppy. So that's not a very good solution.

Thanks in advance!

Aaaah! I figured it out! I’m so proud of myself! Haha.

I took advantage of the HTML markup/standing/code/whatever (I might not be calling that the right name) that translates to a space:   . Here’s the solution.

 

  1. I created that embedded data field in the survey flow: HaveOrSpace.
  2. I defined that field in the survey flow to contain a value of have  for people that I want to see the word “have” and just   for people that should NOT see the word “have”.
  3. Back in the Survey Builder, I wrote the survey question wording (the spot where the piped text should appear) like this. Note that there’s no space after the piped text! I ${e://Field/HaveOrSpace}thoroughly researched programs.
  4. Now, when I preview the survey as someone who SHOULD see “have,” everything looks great: I see “I have thoroughly researched programs.” And if I preview the survey as someone who should NOT see “have,” it also looks good and doesn’t have that double-space I wanted to avoid: “I thoroughly researched programs.”

 

I hope this helps someone else in the future who’s having the same issue with automatically trimmed leading or trailing spaces when defining embedded data! This works well as a way to override that. :)


Leave a Reply