Hi all,
newbie here, so probably a silly question.
I need to create a database to keep track of people's availability during the week, so an entity that has FirstName, LastName and Availability, where Availability is a list of days.
So a typical row of the entity would be
FirstName : John
LastName : Smith
Availability : Monday, Friday, Sunday (as a list)
How can I achieve this?
Thanks for your reply.
Hi Domenico,
You can create a static Entity with seven records for Monday-Sunday. Then create an Entity to keep availability as many-to-many relationship, with attributes PersonId and DayId.
If you need more flexible approach, you can add a text attribute to Availability.
Hi Domenico Gagliano,
Availability column make it text data type and save it as comma separated in the row.
You can use string_split and string_join to achieve this.
Hi Domenico Gagliano, for better control and performance, I recommend using two tables, 'People' and 'PeopleAvailability.' With this structure, you can join the tables to retrieve and manipulate data as needed. This approach provides improved data organization and enables more efficient and flexible querying, making it a scalable and effective solution.
Have a static with the days of the week, and then you need to have another entity which will save the availability. So, you will need an availability entity to save the available days that the record/person will have. And that's it.
After having this. Create a dropdown or a dropdown tag in which you will select the days in the dropdown, the dropdown source is the static of the days of the week as a list and when you click save you will need to loop the selected days and create the respective records. Don't forget to clean any kind of selected days previously to save the new ones.
I believe that having a static entity for days is unnecessary here because, from what I understand, you are storing a date. So, based on that date, we can determine the day of the week. To achieve this, you can create a function or action that returns a string representing the day of the week in the 'PeopleAvailability' table.
Hey @Domenico Gagliano
There are many ways to achieve this, obviously you need to go with something that fits your use case best.
Case 1) When you say Monday, Tuesday etc if you are just concerned of the days and not the date make "Day" as a Static entity with 7 records. (Note this is a static entity, you will not be able to make changes or delete it in runtime.)Case 2) If you are concerned with days and dates both I suggest you to go with this. Here Availability is of datatype "Text". Use comma String_Split to seperate dates Now make structure for each Customer as
here Available Dates has datatype as "Date List" and first name and Last name as normal text.
Thanks Shlok Agrawal