Random choice from a list

Hi community

I have a problem with cascading question in combination with randomization. In my questionnaire, the user would choose multiple from a list of topic. If they chose more than 3 topics, it should show only 3 random topics from previous selected list.

I have tried to create 3 random numbers, using the code as below. However, there is still repetition.

Any suggestion on how to improve it would be appreciated!

Welcome back to the community, @cin_hn! Maybe you will need to share the relevant part ofyour XLSForm to the community so that they could help you out if it’s possible.

Hi @Kal_Lam , here is the XLSForm part that I’m working on it.
I have looked through all topics on the randomization but still got no solution for it.

Book2.xlsx (14.0 KB)

To better locate the problem, can you temporarily change the calculate types to visible types, e.g. text.

Could you try to separate the choice-name from the selected-at in the steps?
See also previous discussion Kobo–matrix_list conditional variable list - #12 by cin_hn.

Can you also share the related part/structure of your form around the calculates, please. (Group? repeat?, type of referenced variables)

Hi @wroos,
Thank you for the suggestion. The solution you suggested above was mine; however, it’s not applicable in the situation - I’m able to make the cascading but having a trouble with the automation, and wondering whether it’s resulted from the combination between cascadiing and automation.

Anyway, I have shared above the part of my code for calculation :slight_smile:

Hi @cin_hn,
Any news on these questions, please? Random choice from a list - #4 by wroos