How to record a random number meanwhile with response? | XM Community
Skip to main content
Solved

How to record a random number meanwhile with response?

  • December 5, 2018
  • 13 replies
  • 20 views

This makes me crazy... My survey is looking for the customer choice when he/she facing incentive with different level. This "different level" is random generated. Then, after survey, I would build a model to quantify the utility of different incentive to the customer choice. Who does know to record those random incentives with customer choice? Thanks!

Best answer by TomG

Assign the random incentive value to an embedded variable, then pipe the embedded variable into your question. The embedded variable value will be included in your response data.

13 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • December 5, 2018
Assign the random incentive value to an embedded variable, then pipe the embedded variable into your question. The embedded variable value will be included in your response data.

  • Author
  • December 13, 2018
what is "embedded variable"?

  • Author
  • December 13, 2018
I am sorry I am fresh. So, how to write it? ${rand://int/15:25} ${e://Field/PV_Price}

  • Author
  • December 13, 2018
> @TomG said: > Assign the random incentive value to an embedded variable, then pipe the embedded variable into your question. The embedded variable value will be included in your response data. I am sorry I am fresh. So, how to write it? ${rand://int/15:25} ${e://Field/PV_Price}

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 13, 2018
@shlzylh, Assign the value in the survey flow: ! Then pipe the value ${e://Field/Price_PV} into your question.

LaurenK
Former XM Community Team Member
Forum|alt.badge.img+13
  • Former XM Community Team Member
  • December 13, 2018
Hi @shlzylh! If you have not yet already, be sure to check out this support page about Embedded Data!

  • Author
  • December 16, 2018
> @TomG said: > @shlzylh, > > Assign the value in the survey flow: > ! > Then pipe the value ${e://Field/Price_PV} into your question. Thanks Tom. I successfully created five Embedded Data in survey flow (Fig.1), and put them into my question (Fig.2). However, when I preview this question, I can not see numbers (Fig.3). What's wrong with me? Fig.1 ! Fig.2 ! Fig.3 !

  • Author
  • December 16, 2018
> @LaurenK said: > Hi @shlzylh! If you have not yet already, be sure to check out this support page about Embedded Data! Thank you very much! I learnt a lot.

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 16, 2018
@shlzylh, You need to move the embedded data assignment block ahead of the question block in your survey flow.

  • Author
  • December 17, 2018
> @TomG said: > @shlzylh, > > You need to move the embedded data assignment block ahead of the question block in your survey flow. Hi Tom, Appreciate your guideline! I tried it, and now the respondents could observe those random numbers in question. And then, I still have another question badly needs your help. During my survey, EV_Price_01 must be not greater than PV_Price_01, when PV_Restriction_Days is 0. How can I build? Thanks a lot! Fig.1 Survey ! Fig.2 Survey Flow ! Fig.3 Preview !

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 17, 2018
> @shlzylh said: > During my survey, EV_Price_01 must be not greater than PV_Price_01, when PV_Restriction_Days is 0. How can I build? Thanks a lot! Unfortunately, I think you'll have to set (or reset) EV_Price_01 using JavaScript. Pipe PV_Price_01 and PV_Restriction_Days into your JS, then use Math.Random.

  • Author
  • December 18, 2018
> @TomG said: > > @shlzylh said: > > During my survey, EV_Price_01 must be not greater than PV_Price_01, when PV_Restriction_Days is 0. How can I build? Thanks a lot! > > Unfortunately, I think you'll have to set (or reset) EV_Price_01 using JavaScript. Pipe PV_Price_01 and PV_Restriction_Days into your JS, then use Math.Random. Sorry. Here is my JS code to setup 'PV_Res_Durations_01' as an Embedded Data. It looks successful. But, I want to make it randomly among 101, 203, 105. How can I make it? Thanks! Qualtrics.SurveyEngine.setEmbeddedData('PV_Res_Durations_01',101);

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 18, 2018
> @shlzylh said: > Sorry. Here is my JS code to setup 'PV_Res_Durations_01' as an Embedded Data. It looks successful. But, I want to make it randomly among 101, 203, 105. How can I make it? Thanks! > Qualtrics.SurveyEngine.setEmbeddedData('PV_Res_Durations_01',101); You've switched what you said you wanted to do from random EV_Price_01 < PV_Price_01 to PV_Res_Durations randomly 101, 203, or 105. Anyway, as I said, to randomly assign values in JavaScript use Math.random()").