Generating a message/note for a random subset of surveys

Hi everyone,

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!

Thanking in anticipation.

There is no direct way however the following steps can help.

  1. Create a calculate question (Q1) using random function that generates a number between 1 and 2 using the formula below
  2. You then create a note question (Q2) after the above random question.
  3. 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.


1 Like

Hi Stephane,

Thank you for figuring this out! I have one question: if I want only two numbers, 0 and 1, to be randomly generated, will I be using this:


Please correct if this is wrong.

Thanks again.

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’).

Responding on this

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.


1 Like

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.

Thanks again!