cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SylvieLet17
Level 8

Check if date overlaps with collection

Hi all, 

I have a form connected to a SharePoint Calendar. 

Users create new "interviews" for external users

There is a column called "ExternalUserName"

I have a collection of filtered records from that calendar.

ClearCollect(MyCollection, Filter(SPCalendar, ExternalUserName=Label1.Text))

 

When someone fills out a NewMeeting form, I want to check whether their meeting overlaps with any other meetings in my collection. My Collection includes: Start time and End time

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Check if date overlaps with collection

Hi @SylvieLet17 ,

Do you want to check whether there's time conflict about meeting time in the same meeting room?

Could you tell me

1)is  Start time and End time field data type datetime?

2)what controls that you use to fill in these two fields?

3)do you have a field that records meeting room?

I assume that:

Start time and End time field data type is datetime; use a datepicker and two drop downs to update start time (end time is the same);use a field to record meeting room(text type)

You could try this formula to check:

If(!IsEmpty(
     Filter(MyCollection,meetingroom=Textinputmeetingroom.Text,
                       (
                           Start time<=DateTimeValue(
        DatePicker1.SelectedDate&Time(Dropdown1.Selected.Value,Dropdown2.Selected.Value,0)
                                                     )&&
                            End time>DateTimeValue(
        DatePicker1.SelectedDate&Time(Dropdown1.Selected.Value,Dropdown2.Selected.Value,0)
                                                   )
                          )||
                       (
                            Start time<DateTimeValue(
        DatePicker2.SelectedDate&Time(Dropdown3.Selected.Value,Dropdown4.Selected.Value,0)
                                                     )&&
                             End time>=DateTimeValue(
        DatePicker2.SelectedDate&Time(Dropdown3.Selected.Value,Dropdown4.Selected.Value,0)
                                                     )
                         )
           )
         ),
   Notify("this room has been ordered",NotificationType.Warning)
  )

I use datepicker1,drop down1,drop down2 to update Start time;

datepicker2,drop down3,drop down4 to update End time.

1232.PNG

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support Team
Community Support Team

Re: Check if date overlaps with collection

Hi @SylvieLet17 ,

Do you want to check whether there's time conflict about meeting time in the same meeting room?

Could you tell me

1)is  Start time and End time field data type datetime?

2)what controls that you use to fill in these two fields?

3)do you have a field that records meeting room?

I assume that:

Start time and End time field data type is datetime; use a datepicker and two drop downs to update start time (end time is the same);use a field to record meeting room(text type)

You could try this formula to check:

If(!IsEmpty(
     Filter(MyCollection,meetingroom=Textinputmeetingroom.Text,
                       (
                           Start time<=DateTimeValue(
        DatePicker1.SelectedDate&Time(Dropdown1.Selected.Value,Dropdown2.Selected.Value,0)
                                                     )&&
                            End time>DateTimeValue(
        DatePicker1.SelectedDate&Time(Dropdown1.Selected.Value,Dropdown2.Selected.Value,0)
                                                   )
                          )||
                       (
                            Start time<DateTimeValue(
        DatePicker2.SelectedDate&Time(Dropdown3.Selected.Value,Dropdown4.Selected.Value,0)
                                                     )&&
                             End time>=DateTimeValue(
        DatePicker2.SelectedDate&Time(Dropdown3.Selected.Value,Dropdown4.Selected.Value,0)
                                                     )
                         )
           )
         ),
   Notify("this room has been ordered",NotificationType.Warning)
  )

I use datepicker1,drop down1,drop down2 to update Start time;

datepicker2,drop down3,drop down4 to update End time.

1232.PNG

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (4,348)