Multi Number Picker for Lotto App

Hi there!

I’ve been stuck with this issue for quite a while. It might be that I used the wrong method or something since I am still very green to Bubble. I have below is a Lotto number picker:

The main issue is that - I am not sure how to limit the entries to 6 entries based on the selection. This one I am stumped. Any other recommended methods is appreciated… in case this one is a dead end method.

Second issue would be kinda just for efficiency because I have a very very convoluted idea of making the numbers show up in the 6 boxes below (based on selection) but it’s a very long “Conditional” statement for each number 1-58. Any fresh ideas on tackling this differently would be greatly appreciated.

Thank you so much!

Hi there, @ianfosgate.23… if I understand your post correctly, what you are describing should be easy to accomplish using a custom state or a list field on the User data type (I would likely go with the latter because I am assuming you don’t want a user to lose their selections if they refresh the page).

So, create a field called picks (or whatever you want to call it) on the User data type, and make that field a number field and also a list. Then, as a user selects numbers, add those numbers to the user’s picks field, and only allow the user to add more numbers when a count of the items in the list field is less than 6.

As far as displaying the selected numbers goes, a repeating group with a data source of Current User's picks should do the trick.

Hope this helps.

Best…
Mike

Edit: one more thought… if users will be picking numbers, say, week after week, you can still go the route I suggested, but instead of putting the picks field on the User data type, put that field in a new data type and create a thing in that data type when a user picks their numbers for a given week.

1 Like

I see! Thank you so much for this insight! I never realized you can do the manipulation via DB. I’ll follow your instructions on how to make it work.

1 Like

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