Backend WF to find subset of things

Hi All.
Bubble noob here. I have a basketball league app I’ve built in Bubble. I also built an iPhone app that’s used by the scorekeepers during the game. When they open that iPhone app, I need it to trigger a backend workflow in bubble to find all of the games that are to be played on the next game day - so the game details, as well as the teams that are playing that night (and all the players on those teams) can be sent to the iOS device. How do I make the backend WF find only those games that occur on the next scheduled game date?

Assuming you have Custom Data Types something like

Game

  • Date - Scheduled Date
  • List of Teams - Teams playing

Team

  • List of Players - Players on the team

Player

  • Text - Name
  • Date - Birthday

Get the next scheduled Game record: Do a search for… Games :filtered Scheduled Date > Current Date & Time → sorted by Scheduled Date → :first item

Get a list of tomorrow’s scheduled Game records: Do a search for… Games :filtered Scheduled Date = Current Date/Time + (1) day → sorted by Scheduled Date

I would double-check the way adding days and comparing Date ranges is handled in Bubble: https://manual.bubble.io/core-resources/data/operations-and-comparisons#…-±days

Hope this helps!

Thanks @sarabeth - I understand what you mean about how to get the next scheduled game, but what I actually need to find are the multiple games that will occur on the next scheduled date. The number of games scheduled on that particular date is variable. So I’d need to use your solution to finding the next scheduled game, then I’m guessing I’d need to store that date as a custom state, and then do a search for all games that share that date. Does that sound right?

That sounds like it would work well!