cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ciprianpopovici
Helper II
Helper II

Building an app for booking cars

Hello,

I try to build an app for car booking for my colleagues. We have 3 spare cars that are used for all the company when it's need.

This cars must be book by two fields: date and time of reception and date and time of return the car. If one person book one car , that car cannot be book in that interval... cars can be book for several hours or multiple days...

I don't have clear ideas for start. Maybe someone can give a hint or an idea.

 

Thank you 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hello, thanks for the solution. I tested and it's working.  If it's not too much i have a little modification in my list, the field Car (car number) in the Sharepoint List it's a text box, and in the PowerApps i changed to a combox with the values from a collection  with car numbers from another list. Below are the data. I don't know how to change the fields in the code you send me , to make it work. can you help me?

Thank you

 

 

ciprianpopovici_0-1637011866142.png

ciprianpopovici_2-1637012044615.png

 

 

On screen visible i put the code for collect, and collect the numbers from the Sharepoint List with the car numbers

 

ciprianpopovici_1-1637011972791.png

 

 

 

View solution in original post

Hi @ciprianpopovici

Do you want to populate the Combo Box with the CarNumber from another list?

 

You just need to modify as the note says:

If(
    !(DataCardValue8.Selected.CarNumber in //Here you should replace the Value with CarNumber from your collection//
        Filter(
            Actions,
            And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) >= ReceptionTime,
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) < ReturnTime
            ) || And(
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) > ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) <= ReturnTime
            ) || And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) <= ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) >= ReturnTime
            )
        ).Car),//Here you should delete the Concat() function//
    SubmitForm(EditForm1),
    Notify(
        "Already reserved!",
        Error
    )
)

 

Best Regards,
Qi

View solution in original post

6 REPLIES 6
BCLS776
Super User
Super User

Here's a suggestion: before you go through the effort of building an app, why not try the built-in calendar functionality in Microsoft 365? You create a "Resource" for each car, and then it gets its own calendar. If that works for your team, then you're all set. If you need more functionality than that, then consider taking it further with an app.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
v-qiaqi-msft
Community Support
Community Support

Hi @ciprianpopovici,

Do you want to create a car booking system?

Could you please share a bit more about your need?

 

Actually, you should prepare a SharePoint list including the Car(Choice), ReceptionTime(Date and time) and ReturnTime(Date and time).

Note that you need to make the Car field Required so that each user must select a car before he create a request.

vqiaqimsft_0-1636617372605.png

You could generate an app directly based on the data source as below:

vqiaqimsft_1-1636617530902.png

Then you could get an app with three different screens:

vqiaqimsft_2-1636617579558.png

Set the OnSelect property of the submit button as below:

If(
    !(DataCardValue8.Selected.Value in Concat(
        Filter(
            Actions,
            And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) >= ReceptionTime,
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) < ReturnTime
            ) || And(
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) > ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) <= ReturnTime
            ) || And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) <= ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) >= ReturnTime
            )
        ).Car,
        Car.Value,
        ","
    )),
    SubmitForm(EditForm1),
    Notify(
        "Already reserved!",
        Error
    )
)

Note that the 'Actions' is my data source and the DataCardValue8 represents the Combo Box corresponding to the Car field in your SP list.

DateValue1, HourValue1, MinuteValue1 separately represents the Date Picker and hour picker and minute picker as below:

vqiaqimsft_3-1636617932593.png

 

Here is a demo, you could check the attachment for details.

 

 

 

 

 

Best Regards,
Qi

Super!! Oau!!!  What a great explanation. I will test your solution and give you a feedback. Thank you

Hello, thanks for the solution. I tested and it's working.  If it's not too much i have a little modification in my list, the field Car (car number) in the Sharepoint List it's a text box, and in the PowerApps i changed to a combox with the values from a collection  with car numbers from another list. Below are the data. I don't know how to change the fields in the code you send me , to make it work. can you help me?

Thank you

 

 

ciprianpopovici_0-1637011866142.png

ciprianpopovici_2-1637012044615.png

 

 

On screen visible i put the code for collect, and collect the numbers from the Sharepoint List with the car numbers

 

ciprianpopovici_1-1637011972791.png

 

 

 

Hi @ciprianpopovici

Do you want to populate the Combo Box with the CarNumber from another list?

 

You just need to modify as the note says:

If(
    !(DataCardValue8.Selected.CarNumber in //Here you should replace the Value with CarNumber from your collection//
        Filter(
            Actions,
            And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) >= ReceptionTime,
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) < ReturnTime
            ) || And(
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) > ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) <= ReturnTime
            ) || And(
                DateValue1.SelectedDate + Time(
                    Value(HourValue1.Selected.Value),
                    Value(MinuteValue1.Selected.Value),
                    0
                ) <= ReceptionTime,
                DateValue2.SelectedDate + Time(
                    Value(HourValue2.Selected.Value),
                    Value(MinuteValue2.Selected.Value),
                    0
                ) >= ReturnTime
            )
        ).Car),//Here you should delete the Concat() function//
    SubmitForm(EditForm1),
    Notify(
        "Already reserved!",
        Error
    )
)

 

Best Regards,
Qi

Thank you, your solution it's working.

All the best!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,022)