Recording Flow ids within the survey as embedded data | XM Community
Skip to main content

Hello, 

 

I have a first part of a survey where 4 blocks are randomly presented (out of 10). I want the program to record the order in which these are presented , as I want to present them the same 4 options (in the same order) in a later part of the survey. 

I know the Flow_ids can be retrieved when we download the excel file which records the order. Is there a way to record it in-survey using javascript? Any help is appreciated! 

 

One of the solution is: Put the four blocks in their own group and then add a embedded data in that groups as ‘blockOrder’ and set it value to ‘ {pipe in blockOrder}, <block number goes here>.

The above set up would give you order of the blocks displayed in the ‘blockOrder’ embedded data. Use this ED in JS to arrange the options.


@Shashi thanks so much! This worked perfectly. I had one follow-up question… 

currently I have blockOrder=${e://Field/blockOrder}a (with a to j denoting the 10 blocks). If the order in which blocks are shown is 3,5,1,10, my output is ceaj. I want to define 4 variables (first, second, .., fourth) that records the 1st, 2nd, 3rd, and 4th letters of the ED blockOrder. Is there an easy command for this? some form of a substring function? 

 

Thanks again!


@Shashi nevermind, I figured out the substring bit! 

 

For anyone else who may need this later…  something like the following should work

var first = blockOrder.substring(0, 1);

var second = blockOrder..substring(1, 2);

 

Thanks again @Shashi 
  


Leave a Reply