Scott,
There are a number of ways to accomplish what you're trying to do. For
simplicity I'll offer the method that I think fits in best with our
Application Builder with the least custom code. There are some ways to do
this that don't involve duplicating parameters, but they all involve
heavily custom code in your form that would make it difficult to manage
with the app builder.
I think the easiest thing to do will be to duplicate the list of questions
three times, and have a hidden value at the beginning of each block of
questions which defines which CHW that block refers to. You can hide the
list of questions as a group if there are less CHW's than 3.
If the number is indeed fairly low (like 3) then your permutations are
fairly limited to 6 total options. If we assign a unique ID to each one:
1-2-3 - Value 1
1-3-2 - Value 2
2-1-3 - Value 3
2-3-1 - Value 4
3-1-2 - Value 5
3-2-1 - Value 6
Then we can have one master Hidden Value that calculates a value between 1
and 6 with an even distribution:
permutation = int(random() * 6) + 1
The int() function is a "floor", and our random function is uniform
between 0 (inclusive) and 1 (exclusive), so that will give us a uniform
distribution from 1 to 6.
Then each of the three repeats can choose which of the chw's to use based
on the permutation
first_chw_name = if(permutation < 3, chw_1, if(permutation < 5, chw_2,
chw_3))
and so on.
Does that make sense? Unfortunately you'll still need to duplicate the
questions, but at least there will only be one set of duplication per slot,
not per combination.
Unfortunately the other thing you'll need to do is add the random
calculation by editing the source of your xform and inserting some custom
code, so that the random() function is only ever fired once.
Create a hidden value with some name (call it random_number, say) and then
click on advanced -> edit source
Find the node that looks like
replace that with
that will make sure that your random number only gets created once. Also,
once you've made that change, don't change the random_number element in the
form editor again later, as it will remove that change.
-Clayton
On Wed, Dec 4, 2013 at 4:44 PM, Scott Lee scott.s.lee@gmail.com wrote:
Hi all,
I was wondering if anyone has any ideas for randomizing question order in
a form.
I'm trying to create a questionnaire to interview households and ask them
to rate their CHWs. Let's say that each village has two CHWs, the names of
which are stored as case properties in a case list, where the village is
the case unit. That is, the case structure is as follows:
VILLAGE CHW1 CHW2
-
Foo John Jane
-
Bar Mary Bill
etc.
To interview a household, the enumerator should choose the household's
village from the case list, and the form should then ask questions about
each CHW within the village. For simplicity, suppose that there is only one
question type ("How would you rate CHW X?"). Currently, the form manually
repeats this question -- i.e., "How would you rate " and "How would you rate " --
rather than, e.g., using repeat groups.
To minimize order effectshttp://www.psychwiki.com/wiki/What_are_order_effects%3F,
it would be helpful to randomize the order in which the two questions are
asked during each interview.
I can think of two ways that this might be possible:
- METHOD 1: Randomly determine which CHW each question references in
its display syntax. I'm envisioning that this would be possible by
creating a secondary hidden value (e.g., CHW1x) that would have a Calculate
Condition such as "if(/data/randomnumber>0.5, /data/CHW1, /data/CHW2)" (and
the converse logic for CHW2x), and then the two questions would reference
these secondary hidden values rather than the original ones.
- *METHOD 2: Randomly determine the order in which questions are
displayed. *This would be possible by having three questions -- one
for CHW1, another for CHW2, and then a third for CHW1 again. The display
conditions for the two CHW1 questions would then be
"/data/randomnumber>0.5" for the first one and
"/data/randomnumber<0.5" for the second one, to determine which one
is displayed.
Two issues to note are: (a) instead of one question per CHW, it's
actually around 20 questions, and (b) the number of CHWs per village ranges
from 1 to 3. As a result, Method 2, for example, is somewhat unappealing,
since it would require repeating the question groups in a 1-2-3-1-2-3-1
pattern to encompass every (ordered) permutation of the three CHWs, which
would make creating and naming the questions rather tedious.
While I hope these methods will work, I wanted to check if anyone knows
of any more efficient methods?
Thanks for any suggestions!
Scott
P.S. Looks like SurveyMonkey has a randomize question orderhttps://www.surveymonkey.com/blog/en/blog/2011/03/03/question-randomization/feature, though I haven't tried it.
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.