cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Hanin
Level: Powered On

Adjast the book a room app template

Adjust book a room app template

I am trying to use the template to book the rooms for predefined sessions times.
I am trying to adjust the start and end time to be like This

Collect(colSessions,
{sName:"Sesstion 1",sTime:"7:30 AM",eTime:"8:20 AM"},
{sName:"Sesstion 2",sTime:"8:25 AM",eTime:"9:15 AM"},
{sName:"Sesstion 3",sTime:"9:20 AM",eTime:"10:10 AM"},
{sName:"Sesstion 4",sTime:"10:25 AM",eTime:"11:15 AM"},
{sName:"Sesstion 5",sTime:"11:20 AM",eTime:"12:50 PM"},
{sName:"Sesstion 6",sTime:"12:55 PM",eTime:"1:45 PM"},
{sName:"Sesstion 7",sTime:"2:00 PM",eTime:"3:00 PM"}
)

The user will be only able to book the room for new meeting so button to book for existing meeting will be hiding.
I am new with powerapp, I managed to do the following:
I created a collection in the app startup and populated a dropdown list with the name of the sessions and inserted 2 text boxes to show the start and end time according to what selected from the dropdown list as the attached image.

The user will select the session form the RoomSelectScreen so no need to go to AdjustDateScreen to adjust the time.


Now my question, I am trying to adjust the app to use the new start and end time but no success until now.

How I can retrieve the available rooms using the selected date and start and end time.

 

12 REPLIES 12
PowerAddict
Level 10

Re: Adjast the book a room app template

Hi, 

 

There are 4 main variables that you need to play with. They are all defined for the 1st time in the OnSelect property of the No Meeting button on the LandingScreen. They are: StartDateTime, EndDateTime, StartDateTimeUTC, EndDateTimeUTC as shown below: 

 

R1.PNG

 

Then when you go to the Room Selector screen, you need to use the session times from whatever the user selects in the dropdown and update these variables possibly using a button to confirm the time (you can then update these variables using the OnSelect property of that button). 

 

That's all you should have to do. These variables then get used on the Confirmation Page (OnVisible property) to create the meeting as shown below: 

 

R2.PNG

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Community Support Team
Community Support Team

Re: Adjast the book a room app template

Hi @Hanin ,

 

On RoomSelectedScreen, the OnSelect property of save button creates the collection "AvailableRoomEmailName". Please change the formula there to work with the new start and end time you created you own:

Capture.JPG

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hanin
Level: Powered On

Re: Adjast the book a room app template

Thank you for your replay I did that and I am not getting the available room right

This is what I did, on the button select I set the 4 variables to be like this:

stTextInput and etTextInput are the end and start times

 

Set(StartDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &stTextInput.Text));
Set(EndDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &etTextInput.Text));
Set(StartDateTimeUTC, Text(DateAdd(StartDateTime, TimeZoneOffset(), Minutes), "[$-en-US]yyyy-mm-ddThh:mm") & ":00.000Z");
Set(EndDateTimeUTC, Text(DateAdd(EndDateTime, TimeZoneOffset(), Minutes), "[$-en-US]yyyy-mm-ddThh:mm") & ":00.000Z");

and copy the code for the on visible

but in some sessions, I got no room available even I am sure the rooms are available

PowerAddict
Level 10

Re: Adjast the book a room app template

Are you setting these on the Room Selector screen? 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Hanin
Level: Powered On

Re: Adjast the book a room app template

Yes

Capture1.PNG

PowerAddict
Level 10

Re: Adjast the book a room app template

I may be missing something here but how are you recording times using your session times in these formulae?

 

Set(StartDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &stTextInput.Text));
Set(EndDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &etTextInput.Text));
Set(StartDateTimeUTC, Text(DateAdd(StartDateTime, TimeZoneOffset(), Minutes), "[$-en-US]yyyy-mm-ddThh:mm") & ":00.000Z");
Set(EndDateTimeUTC, Text(DateAdd(EndDateTime, TimeZoneOffset(), Minutes), "[$-en-US]yyyy-mm-ddThh:mm") & ":00.000Z");

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit(Haman)

Hanin
Level: Powered On

Re: Adjast the book a room app template

by setting the StartDateTime,EndDateTime

The time of the start is taking from stTextInput.Text and then creating new time using the DateTimeValue

and the same thing for the end time

I added 4 labels to show the variable value when the button clicked

Set(StartDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &stTextInput.Text));
Set(EndDateTime,DateTimeValue(Text(StartDateTime, LongDate)&" " &etTextInput.Text));

Capture3.PNG

Hanin
Level: Powered On

Re: Adjast the book a room app template

This the code inside the button

Set(StartDateTime,DateTimeValue(Text(DatePicker1.SelectedDate,LongDate)&" "&stTextInput.Text));

Set(EndDateTime,DateTimeValue(Text(DatePicker1.SelectedDate,LongDate)&" "&etTextInput.Text));

Set(StartDateTimeUTC,Text(DateAdd(StartDateTime,TimeZoneOffset(),Minutes),"[$-en-US]yyyy-mm-ddThh:mm")&":00.000Z");

Set(EndDateTimeUTC,Text(DateAdd(EndDateTime,TimeZoneOffset(),Minutes),"[$-en-US]yyyy-mm-ddThh:mm")&":00.000Z");

Set(CalendarFromSelectMeeting, false );

Set(DateTimeRoomChange, true );

If(DateTimeRoomChange,Set(AvailableRoomsCounter,1);UpdateContext({ShowLoading: true });Set(RoomsLeft,Blank());Set(DateTimeRoomChange, false );If(!NoRoomsList,ClearCollect(AllRooms,Office365.GetRoomsInRoomList(RoomsListsGallery.Selected.Address).value));If(CountRows(AllRooms)>20,Set(AllRoomsConnector,Concat(FirstN(AllRooms,20),Address&";")),Set(AllRoomsConnector,Concat(AllRooms,Address&";")));ClearCollect(AvailableRooms,Office365.FindMeetingTimes({RequiredAttendees:AllRoomsConnector,IsOrganizerOptional: true ,Start:StartDateTimeUTC,End:EndDateTimeUTC,MeetingDuration:DateDiff(StartDateTime,EndDateTime,Minutes),MinimumAttendeePercentage:"1",ActivityDomain:"Unrestricted"}));ClearCollect(AvailableRoomsSorted,SortByColumns(First(AvailableRooms).MeetingTimeSuggestions,"Confidence",Descending));ClearCollect(AvailableRoomsConcat,Concat(Filter(First(AvailableRoomsSorted).AttendeeAvailability,Availability="Free"),Attendee.EmailAddress.Address,","));ClearCollect(AvailableRoomEmails,Split(First(AvailableRoomsConcat).Value,","));ClearCollect(AvailableRoomEmailName,AddColumns(RenameColumns(AvailableRoomEmails,"Result","Email"),"Name",LookUp(AllRooms,Email=Address).Name));UpdateContext({ShowLoading: false });Set(RoomsLeft,CountRows(AllRooms)-20*AvailableRoomsCounter);)

Hanin
Level: Powered On

Re: Adjast the book a room app template

I am still unable to find out what is the issue on retrieving the available rooms on clicking the button

The date and time set in the 4 variables are correct, some times with some session I get some available room and I tried to book one and it booked correctly with the date and the start and end times.

Is there a way to debug the app to follow up with what is happing with the button?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,841)