cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AB21
Post Prodigy
Post Prodigy

how to stop a parent filling out my app booking the same teacher at the same time/date

Hi all,

 

I was wondering if someone can help. 

 

I have created a app that stops a user booking a slot at the same time/date as another user 

 

the time slot is a drop down 

the date is a calendar component

 

the current code iv got works for this but I want to add in a teacher drop down so that a parent/user can book in with a teacher but I want this to be a system which stops the users from booking the same teacher/time/date as another 

 

my current code:

 

If(
IsBlank(LookUp('Parent Booking_1', 'Time slot'=Dropdown1.Selected.Value && Date=DateValue(Text(Calendar_1.StartDate))).ID),
Patch('Parent Booking_1', Defaults('Parent Booking_1'), {Title:TextInput1.Text, Date: DateValue(Text(Calendar_1.StartDate)), 'Time slot':Dropdown1.Selected.Value});Navigate(Screen3,ScreenTransition.Fade),
Notify("The date and time have been selected. Please select another time")

 

I need to add a teacher dropdown to this code and make it so no double bookings are possible. 

 

Please help! Thanks in advance!

11 REPLIES 11

@AB21 

I assume you are getting the Teacher name from the Dropdown?  If so, then this:

If(
    IsBlank(
        LookUp('Parent Booking_1', 
            'Time slot' = Dropdown1.Selected.Value && 
            Date = DateValue(Text(Calendar_1.StartDate)) &&
            Teacher=dropdownTeacher.Selected.Value
        ).ID
    ),

    Patch('Parent Booking_1', 
          Defaults('Parent Booking_1'), 
          {Title:TextInput1.Text, 
           Date: DateValue(Text(Calendar_1.StartDate)), 
           'Time slot':Dropdown1.Selected.Value,
           Teacher:dropdownTeacher.Selected.Value
          }
    );
    Navigate(Screen3,ScreenTransition.Fade),
    
    Notify("The date and time have been selected. Please select another time")
) 
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

thank you @RandyHayes 

 

Worked perfectly

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,188)