Hi,
I am trying to modify book a room template to meet our organization requirement. Is there any option to restrict the room booking either from 9 am to 4 pm or 10 am to 5 PM. Start time should be either 9 am or 10 and end time should be either 4 pm or 5 pm. Will anyone be able to help me to achieve this?
Solved! Go to Solution.
Hi @mtr_windows ,
Do you set your template app as Phone Layout?
I have also made a test on my side, and don't have the issue that you mentioned. The screenshot as below:
Please make sure you have modified your Times collection formula within the OnStart property of App as below:
ClearCollect(Times, {Text: "9:00 am", Minutes: 540}, {Text: "10:00 am", Minutes: 600}, {Text: "4:00 pm", Minutes: 960}, {Text: "5:00 pm", Minutes: 1020})
DropdownStartTime.Items:
Filter(Times, Minutes < 720)
DropdownEndTime.Items:
Filter(
Times,
If(
DropdownStartTime.Selected.Minutes = 540,
Minutes = 960,
DropdownStartTime.Selected.Minutes = 600,
Minutes = 1020
)
)
then remove the formula within the Default property of the DropdownEndTime.
I have attached my sample app below, please open it directly on your side, then check if the issue is fixed.
Regards,
On start of the app it defines a collection with the times. Simply update this to restrict to just the times you want.
see @PowerAddict response here https://powerusers.microsoft.com/t5/Building-Power-Apps/Room-Booking-App-Template/m-p/400044#M117147
Hi @mtr_windows ,
Could you please share a bit more about your scenario?
Do you want to restrict the Start time Dropdown box to be either 9 am or 10 am, and the End time Dropdown box to be either 4 pm or 5 pm?
Actually, the date time options filled within the Start time Dropdown box or End time Dropdown box is based on the Times collection which is initialized within the OnStart property of App. So if you want to restrict the Start time Dropdown box to be either 9 am or 10 am, and the End time Dropdown box to be either 4 pm or 5 pm, you need to make some changes to the Times collection in OnStart property of App.
I have made a test on my side, please take a try with the following workaround:
Modify the ClearCollect(Times, ...) formula in the OnStart property of App as below:
....
Concurrent(
ClearCollect(RoomsLists, Office365.GetRoomLists().value);
If(CountRows(RoomsLists) <= 1,
Set(NoRoomsList, true);
ClearCollect(AllRooms, Office365.GetRooms().value);
Set(AllRoomsConnector, Concat(AllRooms, Address & ";")),
Set(NoRoomsList, false)
),
ClearCollect(Durations, {Time: "30 min", Minutes: 30}, {Time: "1 hr", Minutes: 60}, {Time: "1.5 hrs", Minutes: 90}, {Time: "2 hrs", Minutes: 120}, {Time: "3 hrs", Minutes: 180}, {Time: "4 hrs", Minutes: 240}),
// Modify formula below
ClearCollect(Times, {Text: "9:00 am", Minutes: 540}, {Text: "10:00 am", Minutes: 600}, {Text: "4:00 pm", Minutes: 960}, {Text: "5:00 pm", Minutes: 1020}),
....
)
Then go to the "AdjustDateScreen" of your Template app, then set the Items property of the DropdownStartTime to following:
Filter(Times, Minutes < 720)
set the Items property of the DropdownEndTime to following:
Filter(
Times,
If(
DropdownStartTime.Selected.Minutes = 540,
Minutes = 960,
DropdownStartTime.Selected.Minutes = 600,
Minutes = 1020
)
)
Then remove the formula within the Default property of the DropdownEndTime.
Please try above solution, then check if the issue is solved.
Best regards,
Hi @ v-xida-msft
I have changed the OnStart property of App and made changes on AdjustDateScreen. I can see only 9 am and 10 am as start time and 4 pm and 5 pm as end time. But save option is grayed out even after selecting the start and end time. I have attached the screenshot. Can you help me to fix this?
Hi @v-xida-msft
I am using phone version of the application. I guess you have made the changes in tablet version. Is there anything else I need to change in phone version?
Hi @jlindstrom
I have tried this solution too. But getting same error. At booking page I am getting error as start time should be greater than end time
Please read through the recommended topics that show related to this thread--this question has been asked and answered many times.
Hi @mtr_windows ,
Do you set your template app as Phone Layout?
I have also made a test on my side, and don't have the issue that you mentioned. The screenshot as below:
Please make sure you have modified your Times collection formula within the OnStart property of App as below:
ClearCollect(Times, {Text: "9:00 am", Minutes: 540}, {Text: "10:00 am", Minutes: 600}, {Text: "4:00 pm", Minutes: 960}, {Text: "5:00 pm", Minutes: 1020})
DropdownStartTime.Items:
Filter(Times, Minutes < 720)
DropdownEndTime.Items:
Filter(
Times,
If(
DropdownStartTime.Selected.Minutes = 540,
Minutes = 960,
DropdownStartTime.Selected.Minutes = 600,
Minutes = 1020
)
)
then remove the formula within the Default property of the DropdownEndTime.
I have attached my sample app below, please open it directly on your side, then check if the issue is fixed.
Regards,
Hi @v-xida-msft
Thanks a lot for sharing the template. It is working perfectly fine without any issue. Once again thanks a lot for providing the quick solution and helped me to meet the deadline.
User | Count |
---|---|
198 | |
124 | |
88 | |
48 | |
41 |
User | Count |
---|---|
278 | |
166 | |
138 | |
82 | |
76 |