I'm looking for directions as I (have to) start using java. I'm programming an experiment where participants will be asked to repeatedly choose between two options called A and B.
What would you prefer between these two options?
Option A: xx amount of dollars at time [time level],
Option B: yy amount of dollars at time [time level], where the time level is randomly picked from five levels. Becas
where the time level of option A is randomly picked from three levels [now, 1 week from now, 2 weeks from now] and the time level of option B is randomly picked from five levels [1 week from now, ... , 5 weeks from now]. Furthermore, the time level of Option B must always be greater than the time level of Option B [e.g. if A=1week then B>1week]. This design ended up to be too complicated to be managed within the Qualtrics Survey Flow, so my only way out is to write some lines of java in each question. This Java script should create the five time levels as embedded data, randomly pick one level to be used in Option A and one in Option B (with time B level > time A level) and then I'd show these embedded data as piped text in the question.
I used all the previous contributions about this topic but it's not working the way I hoped. Specifically, when I use java I can't create and visualize an embedded data within the same question. The only way I can make it working is by creating a variable in, let's say, Question Q10 like this:
Qualtrics.SurveyEngine.setEmbeddedData('time','one week from now');
and then, in the following question Q11, write the following:
If I do this, in Q11 I can put time as piped embedded data in the question and see the "one week from now" text visualized.
I tried to put both .set and .get instructions in the same script same question but in this way nothing is visualized in the question.
Any way that I can just put .set and .get lines together and get the variable visualized all in the same question?
Thank you very much for any help you may give.