Randomizing combined with a fixed follow-up question

More
3 years 3 months ago #120284 by logicsurf
logicsurf created the topic: Randomizing combined with a fixed follow-up question
Hello,

I have two short questions regarding randomizing questions:

1) I will have 5 questions I want to randomize but when analyzing the results I want to be able to know in which order the randomized questions were asked. Is this information saved in the database for evaluation?

2) My 5 conditions always come with a secondary question that has to follow the main randomized question. So the format is R1-S1 R2-S2 R3-S3 R4-S4 R5-S5 and I want them randomized e.g. to R2-S2 R4-S4 R1-S1 R5-S5 R3-S3 (so the second question always has to follow the randomized one but has to match it. Can this be done and if yes how because the randomizing function seems to focus on having just the R1 R2 R3 R4 R5 randomized in order but I need the following S1-S5 question before the next randomized question is asked.

Thanks for any help

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago - 3 years 3 months ago #120315 by tpartner
tpartner replied the topic: Randomizing combined with a fixed follow-up question
Assuming all questions are in the same group and you are using group-by-group mode...

1) No, this is not recorded. You could add a short-text question to the group and use JavaScript to hide it and load it with the question IDs in order of display. Add a script like this in the source of the short-text:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {	
		// Hide this question
		$('#question{QID}').hide();
 
		// Load the question IDs
		var qIDs = [];
		$('div[id^="question"]').each(function(i) {
			qIDs.push($(this).attr('id').replace(/question/, ''));
		});
		$('#question33182 input.text').val(qIDs);
 
	});
</script>

2) You can use a script in the source of each randomized question to dynamically move the paired question to follow it. Something like this to move a question with ID 123:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {	
		// Move question ID 123 to follow this question
		$('#question{QID)').after($('#question123'));
	});
</script>

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 3 months ago by tpartner.
The following user(s) said Thank You: logicsurf

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #120372 by logicsurf
logicsurf replied the topic: Randomizing combined with a fixed follow-up question
Thanks for the elaborate answer to my 2 questions. During this day I actually realized that it would probably be easier if I simply shift my 5 twin-questions one level up and turn them into 5 new question categories and just use the category randomization on these 5 twin-questions.

But I guess I will still need an easy fix for recording the order of these 5 randomized questions. Probably the easiest would be to add a hidden question to each of the 5 new categories and have a time stamp automatically added as an answer to each of these 5 hidden questions. Then I can just look at these time stamps to figure out, which questions was asked when.

Is there an easy way to copy the date/time stamp into the answer of a hidden question?

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #120375 by Ben_V
Ben_V replied the topic: Randomizing combined with a fixed follow-up question

Then I can just look at these time stamps to figure out

Good idea!

Is there an easy way to copy the date/time stamp into the answer of a hidden question?


You can use an expression type question:

date + time => {date("d/m/y H.i.s")}
only time => {date("H.i.s")}

Use php date format to match your needs ;)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: logicsurf

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #120420 by logicsurf
logicsurf replied the topic: Randomizing combined with a fixed follow-up question
Ok thanks to both of you. The reconstruction of the randomized order from the time stamps is working just fine.

I had one interesting effect which I've not quite understood: I had to copy the survey so I could publish it and thus check if the time stamp recording is working and it worked just fine but I realized that the randomization which worked before copying the project suddenly did not work anymore on the published version. I tried twice and always got all questions without randomization. Since the randomize group name was still entered in all 5 question groups I could not see why that should happen, so I simply deleted the copy and did exactly the same thing again, copy the project, publish it and then randomization was working as expected. I've not changed any options when copying the project in both cases so I'm not sure why it didnt work in the first case. I'll try again a few times over the next days and see if it happens again...

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!