Hi,
I'm trying to resolve if a certain date range + time are already reserved.
- 2 date pickers for start and end date. 2 dropdown lists of 12hr times. 1 dropdown for room selection.
- I have 5 SharePoint lists columns.
- I would like to display a text saying that a certain date/time is/are taken.
Thank you.
Solved! Go to Solution.
Hi @josefm2 ,
So, first question I would ask is - you are already capturing datetime in your date field - why also then go and capture time in another field? (This seems like an over-complication?)
Second question would be - the user experience could be frustrating, as they have to 'guess' what times are available. Naturally they'll start with the date and time they want, then as they're blocked, they'll start by changing times, then dates - but as they're are increasingly blocked by conflicts this might get frustrating.
Would it not be better to present them with a calendar view showing currently booked times, or even better, just available times for them to choose from?
To answer your question though, essentially we have to assume that any overlap from a requested timeframe on an existing booking is considered a block. Therefore we have to test both ends of the request to see if the start falls inside a booking, or the end falls inside a booking. Only if neither do can we be sure that there are no conflicts.
So, the process of evaluation would be;
I don't know enough about your data construct to give you an exact solution, but in theory the logic of your behaviour formula might looks something like this;
Clear(collectConflicts);
ForAll(Filter(collectMySharePointBookings, bookingDate=requestDate),
If(!IsEmpty(collectConflicts),
If(
(requestStart > bookingStart && requestStart < bookingEnd) OR
(requestEnd < bookingEnd && requestEnd > bookingStart),
Collect(collectConflicts, {Conflict: bookingName})
)
)
)
Behaviour formulas require an event to execute however, so you might want to put this on the OnChange: property of each dropdown/control. We use a collection to contain the state of conflict within the ForAll() and an If() statement checking this collection each time to avoid unnecessary additional processing once a conflict is found. The ForAll() will still run for each line, it just won't bother testing times once a conflict is found and should loop through the rest almost instantaneously.
As mentioned, this can make for a highly frustrating user experience, as they don't know which end of their booking is in conflict, so they have to keep choosing different times to see where they get lucky. A better user experience might be to pop up a visual or calendar view for the day selected that shows either current bookings, or available slots for them to choose from.
[Edit]
Should probably also point out that the thing that will determine the visibility of your "Date already booked" warning would be whether collectConflicts is empty - so in the Visible: property of your warning text label, if the collection is empty, then the label is not visible - something like;
!IsEmpty(collectConflicts)
Hope this helps,
RT
Hi @josefm2 ,
So, first question I would ask is - you are already capturing datetime in your date field - why also then go and capture time in another field? (This seems like an over-complication?)
Second question would be - the user experience could be frustrating, as they have to 'guess' what times are available. Naturally they'll start with the date and time they want, then as they're blocked, they'll start by changing times, then dates - but as they're are increasingly blocked by conflicts this might get frustrating.
Would it not be better to present them with a calendar view showing currently booked times, or even better, just available times for them to choose from?
To answer your question though, essentially we have to assume that any overlap from a requested timeframe on an existing booking is considered a block. Therefore we have to test both ends of the request to see if the start falls inside a booking, or the end falls inside a booking. Only if neither do can we be sure that there are no conflicts.
So, the process of evaluation would be;
I don't know enough about your data construct to give you an exact solution, but in theory the logic of your behaviour formula might looks something like this;
Clear(collectConflicts);
ForAll(Filter(collectMySharePointBookings, bookingDate=requestDate),
If(!IsEmpty(collectConflicts),
If(
(requestStart > bookingStart && requestStart < bookingEnd) OR
(requestEnd < bookingEnd && requestEnd > bookingStart),
Collect(collectConflicts, {Conflict: bookingName})
)
)
)
Behaviour formulas require an event to execute however, so you might want to put this on the OnChange: property of each dropdown/control. We use a collection to contain the state of conflict within the ForAll() and an If() statement checking this collection each time to avoid unnecessary additional processing once a conflict is found. The ForAll() will still run for each line, it just won't bother testing times once a conflict is found and should loop through the rest almost instantaneously.
As mentioned, this can make for a highly frustrating user experience, as they don't know which end of their booking is in conflict, so they have to keep choosing different times to see where they get lucky. A better user experience might be to pop up a visual or calendar view for the day selected that shows either current bookings, or available slots for them to choose from.
[Edit]
Should probably also point out that the thing that will determine the visibility of your "Date already booked" warning would be whether collectConflicts is empty - so in the Visible: property of your warning text label, if the collection is empty, then the label is not visible - something like;
!IsEmpty(collectConflicts)
Hope this helps,
RT
Hi, thank you for the suggestion. I will take a look at it. For now, I have some clarification about what are you pertaining about the ff items. Which are my sharepoint columns(already booked dates) and datepicker values?
1. bookingDate
2. requestDate
3. requestStart
4. bookingStart
5. bookingEnd
6. requestEnd
7. bookingName
Thank you.
Hi @josefm2 ,
Thanks for marking the original solution, but it just occurred to me that there is a gap in my thinking - if someone has a small booking set for the middle of the day, and someone else tries to book a whole day session, the start and end of the request won't land inside the existing booking so we won't detect the conflict. I'm not sure if this situation is likely to occur in your instance, but to correct for this we just need to test in the opposite direction as well (meaning we need to test all bookings against the request, not just the request against all bookings). This would look something like this;
Clear(collectConflicts);
ForAll(Filter(collectMySharePointBookings, bookingDate=requestDate),
If(!IsEmpty(collectConflicts),
If(
((requestStart > bookingStart && requestStart < bookingEnd) OR
(requestEnd < bookingEnd && requestEnd > bookingStart)) OR //request against booking
((bookingStart > requestStart && bookingStart < requestEnd) OR
(bookingEnd < requestEnd && bookingEnd > requestStart )), //booking against request
Collect(collectConflicts, {Conflict: bookingName})
)
)
)
Kind regards,
RT
@RusselThomas thank you for the update. followed your logic and came up with a modified version and it works. Validates a requested overlapping and within dates. The problem now is the time to the 'START DATE' and 'END DATE'.
Is it possible to join 2 sharepoint columns where:
1. A Date column(START/END DATE) is just a text field.
2. A Time column(START/END TIME) is a choice.
If I use just the START/END DATE column, the expression works. It needs to find out if a certain date range is already taken or not. Now I'm trying to add the time to the START/END DATE and it prompts me with the error. If I encapsulate the START DATE and TIME with either value or text to make them the same, it returns saying the reverse. Now it says expecting TEXT value needed but if I set it as TEXT() it then it says it expects a number or value.
ERROR:
WORKING DATE VALIDATION:
Hi @josefm2 ,
Concat() used in this fashion will take all the rows in the source table and using the column you specify will concatenate all the values in that column with the separator you specify, resulting in a single string of concatenated values. The separator you've chosen is 'START TIME'.Value so I'm not sure this is what you're looking for.
I believe your data constructs (Columns and types in SharePoint) are making your expressions overly complex. You could resolve this with conversions and adding dates and times together, but I suspect your formulas might be almost unreadable by the time you're done.
I'm still unclear as to why you need to store Date in one column and Time in another?
From what I've seen, much of this complexity can be resolved by simply adding a StartDateTime and EndDateTime column in SPO and setting them to allow Time. Then your formula's will be relatively simple as you only have one value to reference and it will already be in DateTime format. You can also extract DATE and TIME separately from this whenever you need to.
If you are being forced for some reason to use separate date and time columns, then I'd need to know what the format of your choices in the time column are to help you build the formula to add them with the date column.
The best I can offer is a guess that might help - eg: If they're in the format "08:30" then you could use Split() to pull out the hour and minute values, convert them to numbers using Value() and then plug them into a Time() function which will allow you to add them to the date;
'START DATE' + Time(Value(First(Split('START TIME'.Value, ":")).Result), Value(Last(Split('START TIME', ":")).Result), 0)
This is however just a guess, and assumes 'START DATE' is actually a date format which, when converted to DateTime sets the time to 00:00:00 by default - which in turn allows us to add the Time component ourselves.
Hope this helps,
RT
Thanks so much @RusselThomas, this has helped me solve an issue I was fighting with for few days
just what I have been looking for, I like this part especially "as they don't know which end of their booking is in conflict, so they have to keep choosing different times to see where they get lucky. A better user experience might be to pop up a visual"
I have done like you suggested and have set (start date + time) together, that goes the same for my (end date +time) these are date and time columns in SharePoint.
My question is what would be the best way to show the user what is available to them for their selected dates and time. I was thinking a gallery that filters on your choices automatically as you change the dates and times on the calendar.
How would you go about this?
Hi @RossH85 ,
Probably about 50 different ways to skin that particular cat, but I guess the easiest would be a DatePicker control and a small gallery that shows the events from the day selected in 30min increments - that way you can just colour each increment based on whether there is a meeting scheduled during it or not. Of course, a much easier way might be to just set the calendar up as a resource in Exchange and let people book through Outlook, but assuming you're set on using PowerApps, then that's probably how I'd do it. 🙂
If we consider there are 24 hours in a day, then there are 48 half-hours in a day, so the increment Gallery Items: might look like this;
AddColumns(Sequence(48,0), "Time", DateAdd(DateTimeValue(DatePicker1.SelectedDate), Value * 30, TimeUnit.Minutes))
Then just compare each iteration with anything in the calendar that starts <= it and ends >= it.
Hope this helps,
RT
Episode Fifteen of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Lewis Baybutt aka Low Code Lewis, alongside the latest news and community blogs. Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show. Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse. This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023. Video series available at Power Platform Community YouTube channel. Upcoming events: European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas Join our Communities: Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.
Welcome to our May 2023 Community Newsletter, where we'll be highlighting the latest news, releases, upcoming events, and the great work of our members inside the Biz Apps communities. If you're new to this LinkedIn group, be sure to subscribe here in the News & Announcements to stay up to date with the latest news from our ever-growing membership network who "changed the way they thought about code". LATEST NEWS "Mondays at Microsoft" LIVE on LinkedIn - 8am PST - Monday 15th May - Grab your Monday morning coffee and come join Principal Program Managers Heather Cook and Karuana Gatimu for the premiere episode of "Mondays at Microsoft"! This show will kick off the launch of the new Microsoft Community LinkedIn channel and cover a whole host of hot topics from across the #PowerPlatform, #ModernWork, #Dynamics365, #AI, and everything in-between. Just click the image below to register and come join the team LIVE on Monday 15th May 2023 at 8am PST. Hope to see you there! Executive Keynote | Microsoft Customer Success Day CVP for Business Applications & Platform, Charles Lamanna, shares the latest #BusinessApplications product enhancements and updates to help customers achieve their business outcomes. S01E13 Power Platform Connections - 12pm PST - Thursday 11th May Episode Thirteen of Power Platform Connections sees Hugo Bernier take a deep dive into the mind of co-host David Warner II, alongside the reviewing the great work of Dennis Goedegebuure, Keith Atherton, Michael Megel, Cat Schneider, and more. Click below to subscribe and get notified, with David and Hugo LIVE in the YouTube chat from 12pm PST. And use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show. UPCOMING EVENTS European Power Platform Conference - early bird ticket sale ends! The European Power Platform Conference early bird ticket sale ends on Friday 12th May 2023! #EPPC23 brings together the Microsoft Power Platform Communities for three days of unrivaled days in-person learning, connections and inspiration, featuring three inspirational keynotes, six expert full-day tutorials, and over eighty-five specialist sessions, with guest speakers including April Dunnam, Dona Sarkar, Ilya Fainberg, Janet Robb, Daniel Laskewitz, Rui Santos, Jens Christian Schrøder, Marco Rocca, and many more. Deep dive into the latest product advancements as you hear from some of the brightest minds in the #PowerApps space. Click here to book your ticket today and save! DynamicMinds Conference - Slovenia - 22-24th May 2023 It's not long now until the DynamicsMinds Conference, which takes place in Slovenia on 22nd - 24th May, 2023 - where brilliant minds meet, mingle & share! This great Power Platform and Dynamics 365 Conference features a whole host of amazing speakers, including the likes of Georg Glantschnig, Dona Sarkar, Tommy Skaue, Monique Hayward, Aleksandar Totovic, Rachel Profitt, Aurélien CLERE, Ana Inés Urrutia de Souza, Luca Pellegrini, Bostjan Golob, Shannon Mullins, Elena Baeva, Ivan Ficko, Guro Faller, Vivian Voss, Andrew Bibby, Tricia Sinclair, Roger Gilchrist, Sara Lagerquist, Steve Mordue, and many more. Click here: DynamicsMinds Conference for more info on what is sure an amazing community conference covering all aspects of Power Platform and beyond. Days of Knowledge Conference in Denmark - 1-2nd June 2023 Check out 'Days of Knowledge', a Directions 4 Partners conference on 1st-2nd June in Odense, Denmark, which focuses on educating employees, sharing knowledge and upgrading Business Central professionals. This fantastic two-day conference offers a combination of training sessions and workshops - all with Business Central and related products as the main topic. There's a great list of industry experts sharing their knowledge, including Iona V., Bert Verbeek, Liza Juhlin, Douglas Romão, Carolina Edvinsson, Kim Dalsgaard Christensen, Inga Sartauskaite, Peik Bech-Andersen, Shannon Mullins, James Crowter, Mona Borksted Nielsen, Renato Fajdiga, Vivian Voss, Sven Noomen, Paulien Buskens, Andri Már Helgason, Kayleen Hannigan, Freddy Kristiansen, Signe Agerbo, Luc van Vugt, and many more. If you want to meet industry experts, gain an advantage in the SMB-market, and acquire new knowledge about Microsoft Dynamics Business Central, click here Days of Knowledge Conference in Denmark to buy your ticket today! COMMUNITY HIGHLIGHTS Check out our top Super and Community Users reaching new levels! These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities. Power Apps: Super Users: @WarrenBelz, @LaurensM @BCBuizer Community Users: @Amik@ @mmollet, @Cr1t Power Automate: Super Users: @Expiscornovus , @grantjenkins, @abm Community Users: @Nived_Nambiar, @ManishSolanki Power Virtual Agents: Super Users: @Pstork1, @Expiscornovus Community Users: @JoseA, @fernandosilva, @angerfire1213 Power Pages: Super Users: @ragavanrajan Community Users: @Fubar, @Madhankumar_L,@gospa LATEST COMMUNITY BLOG ARTICLES Power Apps Community Blog Power Automate Community Blog Power Virtual Agents Community Blog Power Pages Community Blog Check out 'Using the Community' for more helpful tips and information: Power Apps , Power Automate, Power Virtual Agents, Power Pages
We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida. Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more. Register today: https://www.powerplatformconf.com/
We are excited to share the ‘Power Platform Communities Front Door’ experience with you! Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well. Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities. Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform. Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.
Welcome! Congratulations on joining the Microsoft Power Apps community! You are now a part of a vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun! Now that you are a member, you can enjoy the following resources: The Microsoft Power Apps Community Forums If you are looking for support with any part of Microsoft Power Apps, our forums are the place to go. They are titled "Get Help with Microsoft Power Apps " and there you will find thousands of technical professionals with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Apps community forums! Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered! Microsoft Power Apps IdeasDo you have an idea to improve the Microsoft Power Apps experience, or a feature request for future product updates? Then the "Power Apps Ideas" section is where you can contribute your suggestions and vote for ideas posted by other community members. We constantly look to the most voted Ideas when planning updates, so your suggestions and votes will always make a difference. Community Blog & NewsOver the years, more than 600 Power Apps Community Blog Articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on building Power Apps. On the Power Apps Community Blog, read the latest Power Apps related posts from our community blog authors around the world. Let us know if you would like to become an author and contribute your own writing — everything Power Apps related is welcome! Power Apps Samples, Learning and Videos GalleriesOur galleries have a little bit of everything to do with Power Apps. Our galleries are great for finding inspiration for your next app or component. You can view, comment and kudo the apps and component gallery to see what others have created! Or share Power Apps that you have created with other Power Apps enthusiasts. Along with all of that awesome content, there is the Power Apps Community Video & MBAS gallery where you can watch tutorials and demos by Microsoft staff, partners, and community gurus in our community video gallery. Again, we are excited to welcome you to the Microsoft Power Apps community family! Whether you are brand new to the world of process automation or you are a seasoned Power Apps veteran. Our goal is to shape the community to be your ‘go to’ for support, networking, education, inspiration and encouragement as we enjoy this adventure together! Let us know in the Community Feedback if you have any questions or comments about your community experience.To learn more about the community and your account be sure to visit our Community Support Area boards to learn more! We look forward to seeing you in the Power Apps Community!The Power Apps Team