I’m posting this for two reasons. One is that I find setting up a randomizer really confusing and yet I’ll probably need it again so I’m leaving it here as a reference for the future. The other reason is that other noobs may be able to follow this as a blueprint when doing something similar.
In order to present a list of text information at random, inspirational quotes or something like that, you need the following:
- You need a database of Questions or Quotes or Psalms or whatever it is you’re trying to present on the screen. I used this for Discussion Questions aimed at ESL students rather than Quotes but the principles are the same. Setting that up is pretty straightforward but you should import it pre-numbered if you can and there are challenges with importing CSV text.
CSV Formatted Text
- Each question needs a corresponding number. This is really important, I got stuck on this for a long time. Though I had everything else set up properly I couldn’t figure out why quotes wouldn’t display. It’s because the numbers that were specified were lacking.
- The Questions that will be displayed in the app need to be:
- Designated as ‘List,’ in this case a list of Questions. Adalo can only pull data from a database through a ‘list.’ This was confusing at first.
- Filter for USER NUMBER. This is really confusing and I still don’t understand why it’s filtered for user number and not QUESTION number but it works.
- The maximum number of items to be displayed should be set at ‘1,’ unless you want to display more than one item at a time.
- Inside the ‘List,’ [double click] the text box/field that will hold each question should be set with magic text as Question Name as you see in the screen capture.
If the text you are randomizing is of unequal length [A mix of short and longer passages] you might find that the ‘List’ jumps around on the screen when it loads. If so, try setting it under ‘styling’ as ‘FIXED’ to the TOP. That cured it for me.
- The button used to fill the text box needs to update the “logged in USER“ with a randomly generated user number between one and the count of total QUESTIONS in the database. [Again, Confusing!] This can be supplied through the magic text or, if the number of quotes is not going to change in the future, as a straight up integer representing the total number of items in the Question database.
- To clear the text box/field before generating the Question, use an update user action to set the user number to ‘0’ on the button from which the Randomizer screen is accessed. Just make sure you don’t have a ‘0’ entry in the database or that will display. That is, start numbering from ‘1.’ Alternately use the zero item as placeholder text. So when you reset to zero that placeholder text will show first to the user. Don’t add the clearing action to the Randomizer screen itself or the Question will be wiped away as soon as it’s generated.
I hope that helps. More experienced devs may want to add to or clarify this.