Enum Events List


How can I write a rule for “Time” so that the event is not scheduled simultaneously and on the same day if I add a new event?

I do not understand what you’re asking. Please elaborate.

How can I write a rule for “Time” so that the event is not scheduled simultaneously and on the same day if I add a new event?

1 Like

You’ll need to use a Valid If expression for the Time column that constructs the list of available time slots. To do so, start with the list of all time slots, then remove the list of unavailable slots, leaving only the available slots:

(
  LIST(
    "07:00:00",
    "08:00:00",
    "09:00:00",
    "10:00:00",
    "11:00:00",
    "12:00:00"
  )
  - SELECT(
    table[Time],
    ([Date] = [_THISROW].[Date])
  )
)

Unfortunately, there’s no way for the expression to know what Enum values are defined, so you’ll have to reproduce that list of values in the expression itself as shown above. Strictly speaking, you probably then don’t even need to define the Enum values, or even use the Enum column type at all–you could just go with a Time column type.

The list of unavailable time slots is gathered using a SELECT() expression to query the table. Note that in the expression above, you need to replace table with the name of the table.

List subtraction is used to remove the unavailable slots from the list of all slots.

See also:




3 Likes

Great it works, small correction
workouts last 1 hour, if workout is at 7:00 then 7:30 should also not be in the choice
how to do it?

(
LIST(
“07:00:00”,
“07:30:00”,
“08:00:00”,
“08:30:00”,
“09:00:00”,
“09:30:00”,

)

  • SELECT(
    table[Time],
    ([Date] = [_THISROW].[Date])
    )
    )
1 Like

I’m not quite sure how others will do it, but as a workaround, I will do something like this

  1. Create a virtual column to calculate the time with this formula.

([time] + “00:30:00”)

  1. Apply this formula

(
LIST(
“07:00:00”,
“08:00:00”,
“09:00:00”,
“10:00:00”,
“11:00:00”,
“12:00:00”
)

  • SELECT(
    table[Time],
    ([Date] = [_THISROW].[Date])
    )

  • SELECT(
    table[Time_virtual],
    ([Date] = [_THISROW].[Date])
    )
    )

1 Like
  1. virtual column to calculate the time with this formula ([time] + “00:30:00”)
    Error - Arithmetic expression ‘([Day1StartTime]+“12/30/1899 12:30:00 AM”)’ has inputs of an invalid type ‘Unknown’

What is the base type format of your enum? Is it text or time?

1 Like

time

Make it “000:30:00”

2 Likes

Column Name ‘VirtualTime1’ in Schema ‘Calendar_Schema’ of Column Type ‘Time’ has an invalid app formula ‘=Payment[Day1StartTime] + “000:30:00”’. Arithmetic expression ‘(Payment[Day1StartTime]+“00:30:00”)’ has inputs of an invalid type ‘Unknown’

Try:

[Day1StartTime] + “000:30:00”
2 Likes

Worked!) but the problem remained, I have it busy from 7:00 to 8:00 and still have 7:30 in my choice

Can you please share your updated formula for your enum?

1 Like

(
LIST(
“07:00:00”,
“07:30:00”,
“08:00:00”,
“08:30:00”,
“09:00:00”,
“09:30:00”,
“10:00:00”,
“10:30:00”,
“11:00:00”,
“11:30:00”,
“12:00:00”,
“12:30:00”,
“13:00:00”,
“13:30:00”,
“14:00:00”,
“14:30:00”,
“15:00:00”,
“15:30:00”,
“16:00:00”,
“16:30:00”,
“17:00:00”,
“17:30:00”,
“18:00:00”,
“18:30:00”,
“19:00:00”,
“19:30:00”,
“20:00:00”,
“20:30:00”,
“21:00:00”
)

  • SELECT(
    Calendar[DayStartTime] ,
    ( [DayStartDate] = [_THISROW].[Day1StartDate] )
    )
  • SELECT(
    Calendar[VirtualColumn1] ,
    ( [DayStartDate] = [_THISROW].[Day1StartDate] )
    )
    )
2 Likes

Are there any other options?

This works on my end. Are you applying this formula to Suggested Values? Please check the value of your virtual column in the Detail View, VirtualColumn1 must show you the value of 07:30:00 AM

Since your schedule allows events every 30 minutes, but a given event may span multiple time slots, you’ll need to indicate explicitly which time slots the event covers. I can imagine two ways to approach this:

  1. The hard way: add one event for each time slot used by a particular event. For instance, an event that lasts an hour would need two rows. If the event is cancelled, you’d have to remove all associated rows.

  2. The easy way: add another column to the table of type EnumList of base type Time to contain the time of every time slot the event covers.

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

I need to hide the value 7:30 if it is busy at 7:00 because the event lasts 1 hour