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
Solved! Go to Solution.
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
On screen visible i put the code for collect, and collect the numbers from the Sharepoint List with the car numbers
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
)
)
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
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.
You could generate an app directly based on the data source as below:
Then you could get an app with three different screens:
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:
Here is a demo, you could check the attachment for details.
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
On screen visible i put the code for collect, and collect the numbers from the Sharepoint List with the car numbers
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
)
)
Thank you, your solution it's working.
All the best!
This is 120% brilliant. I am still struggling to understand the whole thing with the Concat, but it works like a charm 💪
/Frank
Denmark
First of all, I would like to congratulate you for the solution. However, I have an observation, when I try to edit the record the message appears: "Already reserved!". What is your suggestion to fix this?
Hello,
thank you very much for your help!
I would like that a vehicle is automatically added to the booking and not the user does it himself.
I have tried the following:
The vehicle list:
The booking list
The license plate number (DE: Kennzeichen) from the vehicle list should be selected when the vehicle is free for the particular booking and added to the "License plate number" line.
However, the vehicle is selected which is already booked and not which is free. I think this is because of the "=".
If I change it to "<>" then no vehicle is selected. I think it is because of the "LookUp", because it compares only the first elements. Is there another function for this?
Thanks a lot!
Source code:
LookUp(Test.Car; Car.Value = LookUp(Test;
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.Value)
User | Count |
---|---|
254 | |
106 | |
92 | |
47 | |
37 |