Pull a question from database

I’m new to Bubble and I don’t know really anything about backend infrastructure. I have a list of 3000 questions in a database and want to build an app that presents the user with a randomized question to select or to pull another from the database if they don’t like the one presented. Any templates or plugins to help me with this goal?

Hi @scottytuesday,

Welcome to Bubble! Here’s what you can do to get started:

  1. Go to Data > Data Types and create a Type called “Question” . Add fields to this data type. For example, a field with label “Title” that is type “text” so that it can store the Question text.
  2. In Data > App Data you can Upload a CSV if you have your questions in a spreadsheet somewhere. You’ll need to be on a paid plan to upload this data, but it’ll be a fast way to import it all. The uploader will also help you map your CSV columns to the fields you created for the Question data type.
  3. Now, on some page in the Design tab, add a Repeating Group element. This element is specifically for working with lists. You can set it up to be a 1 row/1column layout, “fixed number of cells.”
  4. The type of content for this RG element should be Question and the source should be “Search for Questions: sorted [random sorting]” - this just tells the element to go retrieve all your questions in a random sort order.
  5. Inside the RG cell, add a text element. The text itself should be a dynamic expression: “Current cell’s Question’s Title”. Now, when you preview the page, you’re going to see the first question’s title only. The 1x1 layout makes it so that you’re only seeing one at a time.
  6. Add a button somewhere next to the RG. Create a workflow for this button: When button is clicked > Show Next (found in element actions > repeating group). This button is now programmed to display the next Question in the randomly sorted list.

Hopefully that will give you plenty to play around with and get started. If you have questions or need a hand, just reach out!


Gaby | Coaching Bubble
Private coaching, courses, and tons of free resources

3 Likes

Heya Gaby. Can’t tell you how much I appreciate the speed and quality of your response.

That being said, I followed your instructions diligently (several times), made it to #5, and got stuck. I don’t see a dynamic option for “Current Cell’s Question Title”…

Here’s what I do see:

Ok! Great, the text element needs to be inside the repeating group cell (created in step 3), like this:

With RGs, you design one cell and the rest of the cells/rows will follow suit. Each cell represents a different item (in your case, a question) in the list. Within the cell, you can display field values for that Question record - eg, Current cell’s Question’s Title

1 Like

IT WORKED!!!

Thank you. Thank you. Thank you.

I’d be interested to know if private coaching is available? If not with you, could you recommend someone who can help guide me?

This is a major breakthrough towards me being able to build a working version of my application. For years I’ve been stuck with clickable prototypes of my design but I think I might actually be able to use Bubble to start testing my product theories…in the real world, with real people!!

:pray:

Awesome! :raised_hands:

Yes, we can absolutely get together for coaching. This is what I do full-time, and I’d love to help you keep moving forward. You can book sessions at coachingbubble.com/booking. The site is also full of links to other helpful resources for learning as well.