Hi all,
I am trying to make an app that will allow users to schedule a meeting. This app would be on an iPad, directly outside of the conference room. I want to make many versions of this app, for all of the different conference rooms. I would like each app to have its corresponding conference room as the "main screen". This main screen should display a picture in green if the room is directly available, and red if it is not available. The room I am conducting testing with, is called "Olympus", and has a dedicated email for scheduling, using Outlook.
Currently, in order to refresh the data every 30 seconds, I have a timer, with the OnEnd code:
Set(DateSelected, Today());
Set(DateTimeRoomChange, true);
If(Mod(Minute(Now()), 30) <= 14,
Set(StartDateTime, DateAdd(Now(), -Mod(Minute(Now()), 30), Minutes));
Set(EndDateTime, DateAdd(StartDateTime, 30, Minutes)),
Mod(Minute(Now()), 30) >= 15,
Set(StartDateTime, DateAdd(Now(), -Mod(Minute(Now()), 30) + 30, Minutes));
Set(EndDateTime, DateAdd(StartDateTime, 30, Minutes)),
Set(StartDateTime, Now());
Set(EndDateTime, DateAdd(Now(), -Mod(Minute(Now()), 30) + 60, Minutes))
);
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(BookForMeeting, false);
Set(CalendarFromSelectMeeting, false);
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, "Capacity", "Capacity"));
UpdateIf(AvailableRoomEmailName, Name = "GoPro", {Capacity: "Large"});
UpdateIf(AvailableRoomEmailName, Name = "Kodak" || Name = "Olympus", {Capacity: "Medium"});
UpdateIf(AvailableRoomEmailName, Name = "Polaroid", {Capacity: "Small"});
UpdateContext({ShowLoading: false});
Set(RoomsLeft, CountRows(AllRooms) - 20 * AvailableRoomsCounter)
)
This is all code directly from the "OnVisible" of the RoomSelectScreen in the Book a Room template (I have added the UpdateIf codes).
Since I have a method to refresh the collections, I am using this code for the background color fill:
If("Olympus@ourdomainhere.com" in AvailableRoomEmails.Result,RGBA(43, 121, 35, 0.62),RGBA(102, 7, 7, 0.63))
This method does not seem to work very well. Occasionally, when booking a room, this method does work; however, the app seems to have trouble when meetings end. When a meeting ends, the color stays at red.
For some troubleshooting, I have added a Gallery, with AvailableRoomEmails, and a label with Results. It appears that the collection (either through the OnVisible of the screen, or the timer), does not see that the room is no longer booked. When a meeting ends, Olympus does not populate back into AvailableRoomEmails.
I am hoping someone has another method they can share with me.