[Solved] Take some% from couple of lists and show them in one list


I have a tricky feature I wonder if someone made already.
I’m trying to create a questionnaire that will show random questions from a couple of lists.

the tricky part is that the questions of the main list will be determined by the percentage the user chooses from the small lists. for example 20% of the questions from list A 30% from list B and 50% from list C.

Hope I explained this feature properly.
thanks in advance!

Here’s the algorithm:

Convert your percentages to integers:

You’ll need to round those results. I’m not sure how it will work in terms of adding up to the TotalQuestionCount so you’ll have to play around with that.

…count from 1 to AQuestionCount by 1
______insert random question from AQuestionsList as last in AllQuestionsList
…count from 1 to BQuestionCount by 1
______insert random question from BQuestionsList as last in AllQuestionsList
…count from 1 to CQuestionCount by 1
______insert random question from CQuestionsList as last in AllQuestionsList

You may want to scramble the AllQuestionsList or randomly insert items rather than in sequence so that you don’t just have AABBBCCCC as your question order.


Can you show me how to block it? :pray:

you wrote a program what you want.

app have 4 list, 1 button 1, text_Input1

L1, L2, L3 question list in database for example (A, B, C questions list)

List1 is random select question for user

text_input1 is question amount. user enter it

i didn’t control block (if), you can add.

button click. app automatics calculate a,b,c amount question and select in lists (L1, L2, L3)

i hope app is work for you


1 Like

thank you!

if I want to add more small lists (total 10) how should I do it mathematically?

thank you

if users answer only 10 question, you should set a=2 , b=3, c=5.

10.20/100=2 (%20)
10.30/100=3 (%30)
10.50/100=5 (%50)

Nice work!!! :mechanical_arm:

1 Like