web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Book a Room template -...
Power Apps
Answered

Book a Room template - only show first available room

(0) ShareShare
ReportReport
Posted on by 7

Hi,

 

I have a requirement to show only the first available free room in the roomsgallery and not all free rooms.

I tried using FirstN on the AvailableRoomEmailName collection (in the onvisible of the RoomSelectScreen window) but I didn't succeed.

Hope that somebody can help me in the right direction. Thanks!

For reference, this is my OnVisible code:

 

 

Set(IsPrevRoomSelect; false);;
If(DateTimeRoomChange;
 Set(AvailableRoomsCounter; 1);;
 UpdateContext({ShowLoading: true});;
 Set(RoomsLeft; Blank());;
 If(!NoRoomsList;
 ClearCollect(AllRooms; Office365.GetRoomsInRoomList(RoomsListsGallery.Selected.Address).value)
 );;
 Set(DateTimeRoomChange; false);;
 /*
 If(CountRows(AllRooms) > 20,
 Set(AllRoomsConnector, Concat(FirstN(AllRooms, 20), Address & ";"));
 If(CountRows(AllRooms) > 40, 
 Set(AllRoomsConnector1, Concat(LastN(FirstN(AllRooms, 40), 20), Address & ";"))
 ),
 Set(AllRoomsConnector, Concat(AllRooms, Address & ";"))
 );
 */
 Set(AllRoomsConnector; Concat(FirstN(AllRooms; 20); Address & ";"));;

 
 Concurrent(
 ClearCollect(AvailableRooms; Office365.FindMeetingTimes({RequiredAttendees: AllRoomsConnector; IsOrganizerOptional: true; 
 Start: StartDateTimeUTC; End: EndDateTimeUTC; MeetingDuration: DateDiff(StartDateTime; EndDateTime; Minutes);
 MinimumAttendeePercentage: "1"; ActivityDomain: "Unrestricted"}));

 If(CountRows(AllRooms) > 20;
 If(CountRows(AllRooms) > 40;
 Set(AllRoomsConnector1; Concat(LastN(FirstN(AllRooms; 40); 20); Address & ";"));
 Set(AllRoomsConnector1; Concat(LastN(AllRooms; CountRows(AllRooms) - 20); Address & ";"))
 );;
 ClearCollect(AvailableRooms1; Office365.FindMeetingTimes({RequiredAttendees: AllRoomsConnector1; IsOrganizerOptional: true; 
 Start: StartDateTimeUTC; End: EndDateTimeUTC; MeetingDuration: DateDiff(StartDateTime; EndDateTime; Minutes);
 MinimumAttendeePercentage: "1"; ActivityDomain: "Unrestricted"})
 );
 Clear(AvailableRooms1)
 )

 );;
 If(CountRows(AllRooms) > 20;
 Collect(AvailableRooms; AvailableRooms1)
 );;
 ClearCollect(AvailableRoomsSorted; SortByColumns(First(AvailableRooms).MeetingTimeSuggestions; "Confidence"; Descending); If(CountRows(AllRooms) > 20; SortByColumns(Last(AvailableRooms).MeetingTimeSuggestions; "Confidence"; Descending)));;

 ClearCollect(AvailableRoomsConcat; Concat(Filter(First(AvailableRoomsSorted).AttendeeAvailability; Availability = "Free"); 
 Attendee.EmailAddress.Address; ","); If(CountRows(AllRooms) > 20; Concat(Filter(Last(AvailableRoomsSorted).AttendeeAvailability; Availability = "Free"); 
 Attendee.EmailAddress.Address; ",")));;

 ClearCollect(AvailableRoomEmails; Split(First(AvailableRoomsConcat).Value; ","); If(CountRows(AllRooms) > 20; Split(Last(AvailableRoomsConcat).Value; ",")));;

 ClearCollect(AvailableRoomEmails; Split(First(AvailableRoomsConcat).Value; ","); If(CountRows(AllRooms) > 20; Split(Last(AvailableRoomsConcat).Value; ",")));;

ClearCollect(AvailableRoomEmailName;
 Filter( AddColumns(RenameColumns(AvailableRoomEmails; "Result"; "Email"); 
 "Name";
 LookUp(AllRooms; Email = Address).Name); 
 StartsWith(Name;"Workspace") 
 )
 );; 
 UpdateContext({ShowLoading: false});;
 Set(RoomsLeft; CountRows(AllRooms) - 40 * AvailableRoomsCounter)
);;
Clear(AvailableRooms);;
Clear(AvailableRooms1)

 

 

Categories:
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @bcw ,

     

    Actually, I think you can set Items property of RoomsGallery to First(AvailableRoomEmailName) directly.

    Snipaste_2020-07-15_17-03-59.png

     

    Hope this helps.

    Sik

  • bcw Profile Picture
    7 on at

    Works! Was thinking way to difficult. Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard