I am trying to generate a note/message in Kobo which should only appear for a random subset of surveys. For example, we are visiting 10 households in a day, so this message should appear in 5 randomly selected surveys.
Is there a way Kobo can randomize the survey number and use it to autogenerate this note/message?
If someone has tried this before, please let me know!
Hi
There is no direct way however the following steps can help.
Create a calculate question (Q1) using random function that generates a number between 1 and 2 using the formula below
once(int(2*random())+1)
You then create a note question (Q2) after the above random question.
You can then set a constraint in Q2 to appear when the random number Q1=1 hence only in some instances and not all the 10 visits will the note be displayed.
Please note, your implied definition of ârandomâ above is, well⌠strictly not random. Well, at least not in terms of determining within each survey whether or not to show this ârandomâ question. As defined - âof 10 households visited, 5 should show the questionâ - would require randomly picking a subset of 5 of the 10 a priori, and somehow communicating this pre-selected list to the device when filling in the 10 (and no more or no less) surveys. Picking a random number of 0 or 1 within each form will, on average, show the question 50% of the time, but thereâs no guarantee that it will only show up on exactly 5 of the 10 surveys, or even show up on any of them at all!
Strictly speaking there is nothing (statistically) preventing exactly this from happening (without either a priori determining the 5 of 10, or somehow checking all previous instances - which then makes it no longer ârandomâ).
Yes that should give you a random selection of either 0 or 1.
Kindly note that as inferred by @Xiphware this does not mean that when your run this twice and you get say 0 the first time, then the second run will be a 1. So in other words regardless of your randomisation you may still end with less or more than 5 out of 10. However this is still random but does not guranttee you an exact selection of only 5 out of 10 choices.
Thanks guys, @stephanealoo and @Xiphware . I do understand that the randomness might not result in exactly 5 out of 10 surveys and the solution that has been shared above, this explains what I wanted.