How can I build a random data display generator?

Hello,

I have a database of questions. I would like to build something fairly simple: user clicks on button, a question of this database is displayed, user clicks on button again, another question of this database is displayed, etc.

I am not sure how to go about it. Any ideas? :nerd_face:

Hi there, @sophspages… here is one way to do it…

Put a group on the page, set your questions data type as the Type of content for the group, and set the Data source as Search for Questions:random item (where Questions is the name of your questions data type).

Then, put a button and a text element into the group. Set the text element to display the Parent group's Question's question (where question is the name of the field in the Questions data type where the text of the question is being stored).

Finally, add a workflow to the button and select the Element actions >> Display data action. For the Element, select the name of your group, and for the Data to display, use the same search that you used for the group (i.e., Search for Questions:random item).

Will it be truly random (whatever that means)? Probably not. Will it repeat questions unless you do more work to make sure it doesn’t? Yup, it sure will. But it’s a start, and if you just need something simple, it might get you going down a path.

Hope this helps.

Best…
Mike

2 Likes

Hello @mikeloc thank you soooooo much!! That was super clear and here is my little question prompts generator app :star_struck: Could not do it without you!!

https://lvrsnfrnds-icebreaker.bubbleapps.io/

1 Like

Is there a way to have the search return 50 random values. It’s like do a search for 50 random products every time the page loads… possible?

So when page is loaded just do this:

Search for Products:sorted randomly:items until#50:random item's product name

Thanks you so much…
I suspect however that the expression will randomly display 1-50 products.
If I had 100 products would it look like this? I’ve setup the RG to only display 20 so the limit is on the RG… would it work?

Ultimately the goal is to select 10,20,30 (which ever I set) randomly from a pool company products, lets say 200 that constantly change as the page is loaded.

Screenshot 2024-05-11 at 7.34.41 AM
Screenshot 2024-05-11 at 7.34.54 AM