How to randomly select user email

Hi fellow bubblers,

I want to be able to randomly select and display 1 user email from the registered users table.

Assuming there are 100 registered users, i want to be able to select 1 user by email at random at 12pm each day. This randomly selected email should now be displayed inside all users account as winner of the day.

Kind of lottery.

How do I get this done please.

Thanks

What about:

image

However, it might be a good idea to add some constraints to the search. You might want to add a field that keeps track of previous winners or when a user was a winner before so you cannot have the same user win twice in a row if that is not something you want.

Thanks @vincent56,

You’ve been very helpful to me today.

I implemented above and it did display an email BUT how will the email be changing one from to another everyday by 12pm? I NEED HELP WITH THIS

Then concerning this

I was coming to this. I will definitely like to keep track of previous winners. Any help with this too?

Thanks @vincent56 I’m just new to this stuff but really catching up fast:joy:

You can go the fancy route with API workflows and recurring workflows but you’d have to look into that a bit further.

A simple approach would be to have an action run every x seconds:

As for keeping track of previous winners, it all depends on your needs. You could add a list of dates as a field on the User object. Then each time someone is picked as a winner the date is added to that field. This way you could select winners using that field as a constraint: seach for winners where ‘win date’ < xxx

Or something like that :slight_smile:

I may be wrong but I think ‘Do every x seconds’ only runs while the user is logged in. If so, then an API workflow is definitely the way to go. You should note though that recurring every day requires one of the higher-end Bubble plans - at least it did the last time I checked. An alternative is to use Zapier to schedule a recurring call to your workflow.

Recurring workflows have been discussed extensively here on the forums, so as @vincent56 says, you’ll have to look into it some more.

All the best.

Having tried the Do every x seconds, it still didn’t give me the desired result.
By all means, i think API workflow is def the way to go you both suggested.

I think I’m diving deeper into this.:joy: Please guys do not be tired of me cos i’ll be need more of your help as I explore.

@vincent56 @louisadekoya Thanks a whole lot

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