Ive created a schedule page that has all seven days of the week. Vendors fill in the relevant inputs and Users should be able to view this schedule on the Vendor’s profile.
I created a Schedule data type with fields that correspond to the ones in the screenshot below. Under my Vendor data type I created a field with a List of Schedules type. What is the best way to store this data in my database? I’m not certain this is set up correctly.
Well, you do what you feel suits your use case, it is your app. I would always reference a date, becase one day, you will want to book ahead, and you will get the question ‘which tuesday’
I appreciate your help, but you’re grossly misunderstanding what I’m trying to accomplish. Hopefully someone will come across my query with some guidance.
What else is there to say as in “the best way”…You say you have a list of Schedules type. the schedules type has a number of fields of whatever data type you have selected. You have everything you need.
If you don’t want to use a date, that is your choice (but remember, you can format a date to display on the Day of week).
I’m sorry if I am grossly misunderstanding, but with the information available, I have given my opinion.
Good luck with your app, and hope someone who understands better can help you.
If you store the days of the week as text, it may well get tricky when trying to display them in order.
So what I might be tempted to do is create a “DaysOfTheWeek” datatype, which has both an index 1 = Monday or Sunday etc and then the Display Name.
To make life easier for yourself (just trying to avoid having to schedule an API task to set up the 7 weekly slots) you might want to create the dummy slots when you enter the page. As we are unlikely to have more that 7 days in the foreseeable future, you could hard code the creation of the 7 slots on page entry, then autobind the inputs.
Worth mocking this up quickly to see if it will work.
If you look at my screenshot above, you’ll see there are seven distinct zones for each day in a calendar week. Those zones were already organized into individual groups when I posted my query. I took @NigelG’s idea for an index and numbered each zone. I just put an input in the corner of each zone with a number 1-7 as the default value and disabled the input. I then added a button to allow my vendors to edit the zones independently of one another instead of saving them all simultaneously. Now when I need to display the schedule to users, I can organize the days of the week using that index number. See the screenshot below.