Calendar valid if

hi, i have an app where i fill the date and hour of an apointment in a form and in a calendar view i can see the the clients in the dates they where registered but i cant see the calendar view when im filling the form couse it doesnt support it, is there a way that i can create a valid if so if a date and hour is already assigned it doesnt let me save on top of it? or a way that the sistem shows me the available hours for appointments in that date?

Solved Solved
0 11 1,083
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

Yep.

ISBLANK(
  FILTER(
    "CalendarTable"
    AND(
      ([_THISROW].[Date] = [Date]),
      ([_THISROW].[Time] = [Time])
    )
  )
  - LIST([_THISROW])
)

FILTER(...) gets list of all appointments that already exist with the formโ€™s date and time. FILTER(...) - LIST([_THISROW]) removes the row in the form from that list, making it a list of other appointments at the same date and time. ISBLANK(...) asks, are there no other appointments at the same date and time? If yes (there are no others), the formโ€™s date and time is available.

Yep.

(
  LIST(
    "07:00", "08:00", "09:00", "10:00", "11:00",
    "12:00", "13:00", "14:00", "15:00", "16:00"
  )
  -
  SELECT(
    CalendarTable[Hour],
    ([_THISROW].[Date] = [Date])
  )
)

LIST(...) is the list of all possible appointment times in a day. SELECT(CalendarTable[Hour], ...) gets the list times for all currently-scheduled appointments on the given date. LIST(...) - SELECT(...) removes the scheduled appointments from the possible appointments slots, leaving only unused appointment slots.

See also:






View solution in original post

11 REPLIES 11

Steve
Platinum 4
Platinum 4

Yep.

ISBLANK(
  FILTER(
    "CalendarTable"
    AND(
      ([_THISROW].[Date] = [Date]),
      ([_THISROW].[Time] = [Time])
    )
  )
  - LIST([_THISROW])
)

FILTER(...) gets list of all appointments that already exist with the formโ€™s date and time. FILTER(...) - LIST([_THISROW]) removes the row in the form from that list, making it a list of other appointments at the same date and time. ISBLANK(...) asks, are there no other appointments at the same date and time? If yes (there are no others), the formโ€™s date and time is available.

Yep.

(
  LIST(
    "07:00", "08:00", "09:00", "10:00", "11:00",
    "12:00", "13:00", "14:00", "15:00", "16:00"
  )
  -
  SELECT(
    CalendarTable[Hour],
    ([_THISROW].[Date] = [Date])
  )
)

LIST(...) is the list of all possible appointment times in a day. SELECT(CalendarTable[Hour], ...) gets the list times for all currently-scheduled appointments on the given date. LIST(...) - SELECT(...) removes the scheduled appointments from the possible appointments slots, leaving only unused appointment slots.

See also:






Thanks

Hi Steve,

but where would you write those formulas?

Thanks

Greetings everyone
I've tried to replicate the dating formula but it doesn't work perfectly
In practice, more users have the possibility of booking periods during the day with a difference of 30 minutes
example in suggested values
LIST(
โ€œ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:00:00โ€, โ€œ18:00:00โ€, ) In Valid if for START time and END time I have entered AND([START] < [END],
COUNT(FILTER(โ€œPRENOTAโ€,
AND(
[EMAIL_TECNICO] = USEREMAIL(),
[DATA] = [_THISROW].[DATA],
AND(
([START] >= [_THISROW].[START]),
([START] <= [_THISROW].[END])
))
)
) = 0
) I cannot understand and cannot resolve the error that
IT WON'T LET ME INSERT 10:00:00 - 10:30:00
but in the period is free!! these are the data entered 06/10/2023 08:30:00 10:00:00
06/10/2023 10:30:00 11:00:00
06/10/2023 14:00:00 16:30:00
--------------------------------------------
06/10/2023 10:00:00 10:30:00 (NOT ENTERED) ERROR

why ?
there is another solution and/or method ?



 

Mike_T
New Member

I thought that this might have solved a problem I am having too but sadly, I donโ€™t think Iโ€™m inputting it correctly. My situation is slightly different as a Trainer can be booked for multiple days in a row. So somehow Iโ€™m trying to invalidate any start date that is on a previously booked start date or during any multiday period between start date and end date. For the same Trainer. And obviously canโ€™t book a trainer in the past. I modified Steveโ€™s suggestion above with the below. I put this in the ValidIf formula in the Start Date column of my Book a Trainer Form. Thoughts?

ISBLANK(
FILTER(โ€œTrainerScheduleโ€, AND(
([_THISROW].[Start Date] = [Start Date]),
([_THISROW].[Start Date] > [End Date]),
([_THISROW].[Start Date] >= Today()),
([_THISROW].[Trainer_Name] = [Trainer_Name])

)
)

-LIST([_THISROW])
)

May I request to try something like below as Valid_if expression

AND(
ISBLANK(
FILTER(โ€œTrainerScheduleโ€, AND(
([_THISROW].[Start Date] >= [Start Date]),
([_THISROW].[Start Date]<= [End Date]),

([_THISROW].[Trainer_Name] = [Trainer_Name])

)
)

-LIST([_THISROW])
) ,

[_THISROW].[Start Date] >= TODAY()
)

Suvrutt,
I woke up at 5am with this formula rolling around in my head and I finally realized my error and came up with the following:

ISBLANK(
FILTER(โ€œTrainerScheduleโ€, OR(([_THISROW].[Start Date] < Today()),AND(
AND(([_THISROW].[Start Date] >= [Start Date]),
([_THISROW].[Start Date] < [End Date])),
([_THISROW].[Trainer_Name] = [Trainer_Name]))

)
)

  • LIST([_THISROW])
    )

It seems to work with what I throw at it. Do you see any issues vs your suggestion?

Thanks your reply! This really is a great community of support!

You are welcome @Mike_T

Excellent to know you have got it working.

Yes, you are correct. AppSheetโ€™s is a great community!

Suvrutt,

Just when I thought I had it lickedโ€ฆ Iโ€™m trying to validate the End Date so the user cannot overlap the next Start Date.

ISBLANK(
FILTER(โ€œTrainerScheduleโ€, AND(
([Start Date]>[_THISROW].[Start Date]),
([_THISROW].[Trainer_Name] = [Trainer_Name]))

)

-LIST([_THISROW])
)

I thought I had it with the above but this filters out all of the dates > my start date.

I believe if you are trying to apply similar logic to the [End Date], then the [End Date] valid_if may be something like below

AND(
ISBLANK(
FILTER(โ€œTrainerScheduleโ€, AND(
([_THISROW].[End Date] <= [End Date]),
([_THISROW].[End Date]>= [Start Date]),

([_THISROW].[Trainer_Name] = [Trainer_Name])

)
)

-LIST([_THISROW])
) ,

[_THISROW].[End Date] >= TODAY()
)

These both work very well! Thanks again!

Top Labels in this Space