web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Bike Rental with reser...
Power Apps
Answered

Bike Rental with reservation based on time and bike

(0) ShareShare
ReportReport
Posted on by 15

I have a Power Apps Application linked to a Sharepoint list called Rental Info. In it are columns such as StartDate EndDate and Bike Choice.

 

I have a form linked to this database. The Bike Choice field is a dropdown with two values Red Bike and Blue Bike. The Bike Choice is a Choice column. The dropdown is called BikeVal in powerapps. StartDate is called DateValue1 in powerapps and EndDate is called DateValue2.

 

I want to make sure that when user selects a date that it then checks if the chosen date is already in the Sharepoint list. If the date (and time) is already in there then the bike should not be displayed. I have tried this by using the onchange on the selected date to compare it with the date a bike has been reserved but so far it has not worked. I am fairly new to PowerApps so I might be missing something very obvious. 

Is there something wrong with my data model? Should I use lookups in the sharepoint to a list of the bikes? How can I show the available bike on the selected date(and time)? 

I appreciate any help and thank you in advance!

Categories:
I have the same question (0)
  • Verified answer
    v-mengmli-msft Profile Picture
    on at

    Hi @Gingertopia ,

     

    I am assuming that you are using the below formula on Items of BikeVal drop down:

    Choices([@'Rental Info'].Bike)

    Please try this on Items of BikeVal:

    Filter(Choices([@'Rental Info'].Bike),Not(Value in AddColumns(Filter('Rental Info',StartDate<=DataValue1&&EndDate>=DataValue2),"test",Bike.Value).test))

     

    Best regards,

    Rimmon

  • Gingertopia Profile Picture
    15 on at

    This works! You're my savior. I had to edit a little bit and came out to: 

    Filter(Choices([@'Rental Info'].BikeChoice),Not(Value in AddColumns(Filter('Rental Info',StartDate<=DateValue1.SelectedDate &&EndDate>= DateValue2.SelectedDate),"test",BikeChoice.Value).test))

    I do have another question, if I want to add the time aswell shoul I add the time in the function? In the Sharepoint it's date and time column. Is it as simple as just adding minutevalue1.selected? I am getting an error right now if I try to add that. 
  • Gingertopia Profile Picture
    15 on at

    Okay update; it's not working as it should. I have three entries in the Sharepoint: 

    Gingertopia_0-1704709911234.png

    If I fill in the first dates in the app the only option is the red bike. However when I try to validate the other options to see if the right option would show; it shows both options. I am wondering what I am doing wrong. 

    Gingertopia_1-1704709999091.png

     

  • v-mengmli-msft Profile Picture
    on at

    This is because your Start and End are date and time columns, DateValue just get date.

    Please replace DateValue in code with:

    DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value)
    DateValue2.SelectedDate + Time(Value(HourValue2.Selected.Value), Value(MinuteValu2.Selected.Value)
  • Gingertopia Profile Picture
    15 on at

    Awesome! I do have the other issue though. As of right now it seems that it can only filter on the newest row that has been added to the sharepoint list because if I make a new reservation it filters on that but if I try the other reservations both bikes still show up in the form. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard