Message of the Day Logic/Architecture (New item from list each day)?

Options
Message of the Day Logic (New item from list each day)?

I'm new to Xano but I've been building things for years. So, I'm familiar with data architecture but still feel like a noob in a lot of ways. Here's what I'd like to try to get to know Xano:

Display a new message each day on a front end, but have Xano handle all the logic for which message is retrieved.

What I have, and haven't, done and would love some advice on:
1. Store a database of messages. (Done)
2. Pull those messages into my front end. (Done)
3. Create a filter that randomizes the list and pulls out one (Done using array filters Shuffle + Shift, thanks to Michael).
4. Persist that message for one day only. (Not done)
5. Pull a new message for the next day and move the previous day's message to the bottom of the list. (Not done)
6. Eventually, the messages will loop/start over because I won't have thousands of entries - likely it'll be double digits at most. (Not done)
 

How would you go about thinking through this? Any ideas? 

Thanks!

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    This is do-able. The "for the day" part is most easily done via a background task that runs once daily to set your message of the day. The question of "bottom of the list" isn't quite the same as "shuffle" to get a random one. Are you looking to have, say, 30 messages and pull them at random? 30 messages which you want to run in a reliable queue? A mix - 30 messages picked at random, but a check to make sure it's not 2 days in a row? All are possible, hence the question so I can point you in the right direction.
  • Josh Chambers
    Options
    Thanks, Ray! The last example would be ideal. However, the reliable queue would work for now as well. 

    But, I'm using this to get to know Xano (And Draftbit, as you may now know from today's office hours). To that end, I'd love to learn how to do what you said in your last example (Random + preventing repeats). And, it might be nice to also set the "day" parameter to prevent a message being repeated too frequently. 

    Thanks much.
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    I put together a video with a method even simpler than the one I described above. Let me know if you have qs! https://www.loom.com/share/ad3743ed39c845ac91cff434fa934e8f

    Adding some randomness to the selection process (my third option above) is do-able, but I thought I should stop at 10m. Let me know if you have further qs! 
  • Josh Chambers
    Josh Chambers Member
    Options
     This was fantastic. Thank you! I watched it quite a few times, and just kept running through it until all the logic clicked for me. Incredibly helpful, thanks! One note: you didn't show the "Edit Record" function in the video, but I figured it out. So nifty!