How to record a random number meanwhile with response? | XM Community
Skip to main content
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!
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.
what is "embedded variable"?
I am sorry I am fresh. So, how to write it?

${rand://int/15:25}

${e://Field/PV_Price}
> @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}
@shlzylh,



Assign the value in the survey flow:

!

Then pipe the value ${e://Field/Price_PV} into your question.
Hi @shlzylh! If you have not yet already, be sure to check out this support page about Embedded Data!
> @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

!
> @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.
@shlzylh,



You need to move the embedded data assignment block ahead of the question block in your survey flow.
> @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

!
> @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.
> @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);
> @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()").

Leave a Reply