Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Display whole collection in gallery for filtering in Book a Room Template

Posted on by 94

In the Book a Room template, on RoomSelectScreen page I want the RoomsGallery to display all of the results that are contained in the AvailableRoomEmailName collection.

 

This is because I have a dropdown box to filter the room displayed - this worked fine in testing as I only added a handful of rooms, but as I have now added all rooms (equalling 93) the filter no longer works as the gallery doesn't display all of the collection.

 

Any help would be greatly appreciated.

 

Thanks,

Rob

  • RobChilds Profile Picture
    RobChilds 94 on at
    Re: Display whole collection in gallery for filtering in Book a Room Template

    Thanks @StalinPonnusamy 

     

    I have a collection (AvailableRoomEmailName) of a maximum of 93 items. These items are displayed in a Gallery (RoomsGallery) which can be filtered by a dropdown.

     

    The trouble I'm having is that the gallery doesn't automatically display up to 93 items, it is being limited somehow. 

     

    Here's is the code on the OnVisible property of the screen that I think that needs changing to allow the RoomsGallery to display more items...

     

    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(AvailableRoomEmailName, Filter(AddColumns(RenameColumns(AvailableRoomEmails, "Result", "Email"), "Name",

            LookUp(AllRooms, Email = Address).Name), Name <> "Car Park Space 1E", Name <> "Car Park Space 2E", Name <> "Car Park Space 3", Name <> "Car Park Space 4", Name <> "Car Park Space 5", Name <> "Car Park Space 6", Name <> "Car Park Space 7", Name <> "RC_Zoom"));

        UpdateContext({ShowLoading: false});

        Set(RoomsLeft, CountRows(AllRooms) - 40 * AvailableRoomsCounter)

    );

    Clear(AvailableRooms);

    Clear(AvailableRooms1);

  • Verified answer
    Re: Display whole collection in gallery for filtering in Book a Room Template

    Hi @RobChilds 

     

    The best practice is to use the filter to make sure results are under the configured settings.

     

    Example: (Optional Dropdown and Text Search)

    With(
     {
     sData: Filter(
     'Issue tracker',
     IsBlank(ComboBox3.SelectedItems.Value) || IsEmpty(ComboBox3.SelectedItems) || Priority.Value = ComboBox3.Selected.Value
     )
     },
     If(
     Not(IsBlank(TextInput2.Text)),
     Search(
     sData,
     TextInput2.Text,
     "Title"
     ),
     sData
     )
    )

      

    "Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful. "

  • Re: Display whole collection in gallery for filtering in Book a Room Template

    Hi @RobChilds 

     

    By default, the app pulls only 500 records. but you can change up to 2000 (Max) through settings.

     

    File > Settings > Data row limit

    StalinPonnusamy_0-1627661781632.png

     

    Limitation:

    StalinPonnusamy_1-1627661828932.png

     

    Please let us know any questions about the filter that we can help with.

  • RobChilds Profile Picture
    RobChilds 94 on at
    Re: Display whole collection in gallery for filtering in Book a Room Template

    Thanks @Anonymous ...

     

    I do have a filter but as the gallery doesn't display all items of the collection the filter doesn't work correctly (or rather it only filters the results that are visible, not all the results that are within the collection).

     

    Cheers,

    Rob

  • Re: Display whole collection in gallery for filtering in Book a Room Template

    Hi @RobChilds ,

     

    Try using Filter formula in the Items property of your gallery. Just make sure that you have the latest data from your datasoure/collection.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard