Piped text in embedded JavaScript - can you loop or predict the piped text codes? | XM Community
Skip to main content

My team is working on a survey with multiple SxS tables, and each have 50+ rows of information. We are working on implementing summary slides between each SxS table that do calculations with JavaScript and display a total.

Our solution so far is to loop through an array with 200 entries with the piped text codes written out. This is not feasible long term, because there will be multiple versions of this survey with different entries in the SxS table. What I’ve found is that when the survey is modified, the codes continue to increase, and I now have entries with a piped text code of more than 200. 

I’m looking for a solution that doesn’t involve simply increasing the size of the array. Is there a way to either:

  1. create a loop that builds the piped text codes,
  2. predict what the new piped text codes will be when the survey is modified,
  3. reset the codes when a new survey is created so that they don’t get higher than 200?

Any help would be highly appreciated.

I’d like to simplify my question by focusing on the third option: when we create a new survey by duplicating our template, is there a way to then reset the piped text question codes so that they don’t continue to increase in number? 

Thanks.


Leave a Reply