Filter random item from Bubble data API

Hi,

I have data in a Bubble data table that I use to pull a random item from to display in my app. That data has a field - ‘Gender’ - and I want to have the user select the Gender of choice so the random item displayed matches the selected gender in the Gender field.

Selecting the random item is OK but I can’t see a way in which I can only display a random item that matches the user’s choice of gender.

TIA :slight_smile:

Hello, what is the relation between that item and the gender? Do you have a gender field in that item object?

The Gender description is associated with each item. The data table has 3 fields:

  • Card
  • Comfort level
  • Gender

It is the Card field that is selected at random and displayed, I want the choice to be based on the Gender field. The next stage is to nest another filter on Comfort level too, again another user selection.

You just need to add a constraint like Gender = Dropdown Gender's value. If that’s not clear, I can assist you better if you share a screenshot.

Thanks for the response. I have attempted to add the constraint but failed. Here are the screenshots of the app pages and data table.



Is it possible to share the app with me?

Not possible on my plan unfortunately. It’s there any other information I can provide?

You can change the setting the app as everyone can view under settings-> general and you can send the editor link via dm.

I’ve changed the setting but this is a new forum account so I can’t DM. Email?

I send you a message

Where do you want to get the gender data? There is no gender field for the User object and I couldn’t find something like a gender dropdown

I’ve added a quick test page - player_choices.

The field is a drop-down selection titled ‘gender_choice’

The flow would be that the user selects this gender by visiting this page before the other pages.


Each truth data should have only one gender. After fixing this, you can filter your data here

gender = dropdown gender's value

Also you don’t need the refresh the page step for the draw the truth card button.

Thanks for this :pray:

Can the gender selection element be on a different page in the app or does it need to be on this specific page?

If you want to get the gender data from an element like a dropdown, yes, they need to be in the same page. If you want to get it from the database, like User's gender, so you can get it from anywhere.

Also, I highly recommend using option sets for this. Do you know how to use it?

No, but I’ll take a look at option sets as they arrive like an interesting solution.

Thanks for your help on this, it’s real appreciated :+1:

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.