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 / Collection isn't showi...
Power Apps
Unanswered

Collection isn't showing filtered results from multi-select choice buttons

(0) ShareShare
ReportReport
Posted on by

 

Hello all,

 

In short, I have a "Book A Room" app. I have a multitude of rooms that each contain their own unique attributes. For example: one room may contain a "Single Screen" and "Double Projector", while another room may only contain a "Single Projector".

 

I have an application that uses a choice column in SharePoint (that holds all possible attributes for a specific room) in the form of buttons (for each attribute). Here is a screenshot of the screen, "FilterScreen":

jharville_0-1629428040098.png

 

In the 'Save' button's OnSelect of the FilterScreen, there are 2 important collections being made: 'Info' and 'FilteredMatchRooms'. Here is the code for the OnSelect of the 'Save' button:

 

Collect(
 Info,
 Filter(
 AddColumns(
 colConferenceroom,
 "AttributesNew",
 Concat(
 Attributes,
 Value,
 ", "
 )
 ),
 Text(
 First(
 Split(
 varSelectedAttributes.Value,
 ", "
 )
 ).Result
 ) in AttributesNew Or Text(
 Last(
 FirstN(
 Split(
 varSelectedAttributes.Value,
 ", "
 ),
 2
 )
 ).Result
 ) in AttributesNew Or Text(
 Last(
 FirstN(
 Split(
 varSelectedAttributes.Value,
 ", "
 ),
 3
 )
 ).Result
 ) in AttributesNew Or Text(
 Last(
 FirstN(
 Split(
 varSelectedAttributes.Value,
 ", "
 ),
 4
 )
 ).Result
 ) in AttributesNew Or Text(
 Last(
 FirstN(
 Split(
 varSelectedAttributes.Value,
 ", "
 ),
 5
 )
 ).Result
 ) in AttributesNew Or Text(
 Last(
 FirstN(
 Split(
 varSelectedAttributes.Value,
 ", "
 ),
 6
 )
 ).Result
 ) in AttributesNew
 )
);
ForAll(
 AllRooms,
 If(
 !IsBlank(
 LookUp(
 Info,
 Info[@Title] = AllRooms[@Address]
 )
 ),
 Collect(
 FilteredMatchRooms,
 {
 Name: AllRooms[@Address],
 DisplayName: LookUp(
 Info,
 Title = AllRooms[@Address]
 ).DisplayName,
 AttributeNew: LookUp(
 Info,
 Title = AllRooms[@Address]
 ).AttributesNew
 }
 )
 )
);
Navigate(
 RoomSelectScreen,
 ScreenTransition.Cover
)

 

 

* 'Info' = the collection that pulls up the attributes selected from the choice of buttons in the "Filter Screen" :

jharville_1-1629429017724.png

 

 

 

* 'FilteredMatchRooms' = Want this to pulls in all of the rooms have contain at least one of the attributes selected in the FilterScreen

jharville_2-1629429077555.png

^^ FilteredMatchRooms should be the collection set in the Items property of my Gallery (RoomsGallery_1) to show the filtered selection of rooms, but currently the Gallery is empty since it isn't properly pulling a room that has at least one of the attributes selected in the FilterScreen.

 

jharville_0-1629429782948.png

 

 

I suspect the error has to be somewhere in the 'Save' button's OnSelect of the FilterScreen. There are no errors with my code, but I think potentially organization of the code or something small. Would anybody be able to help advise? 

 

Thank you so much! 🙂

 

 

 

Categories:
I have the same question (0)
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @jharville ,

     

    We can make some tests:

    1\ Add a button besides the save button, OnSelect set to:

     

    ForAll(
     AllRooms,
     Collect(
     colTest1
     {
     Value: If(!IsBlank(LookUp(Info,Info[@Title] = AllRooms[@Address])),"1","2")
     }
     )
    )

     

     

    2\ Add a label, Text set as below:

     

    CountRows(Filter(colTest1,Value = "1"))

     

     

    3\ You could know if there is something wrong with the if statement, if the result is 0.

     

    4\ Add another button, OnSelect set to below and set Gellery Items to colTest2, see if there is any difference:

     

    ForAll(
     AllRooms As A,
     If(
     !IsBlank(
     LookUp(
     Info,
     Title = A.Address
     )
     ),
     Collect(
     colTest2,
     {
     Name: A.Address,
     DisplayName: LookUp(
     Info,
     Title = A.Address
     ).DisplayName,
     AttributeNew: LookUp(
     Info,
     Title = A.Address
     ).AttributesNew
     }
     )
     )
    );

     

      

    Waiting for your response. Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • jharville Profile Picture
    on at

     

    @v-jefferni Thank you so much for the response. As for your 1-3 bullets, I inserted a button with the OnSelect code you mentioned, as well as a label with the Text code you mentioned.

    I selected 3 attributes, and clicked the test button, and saw that "0" still showed up in the label.

    Also, you can see I put another test label above the buttons that shows the concatenated results of the button selections from varSelectedAttributes.Value (inside the "Text" property of the label)

     

    jharville_0-1629470035326.png

     

    As for your instructions in Step 4, I made a new button and put your code in the OnSelect. 

     

    jharville_1-1629470419022.png

     

    After making the same 3 attribute selections and clicking the button, I changed the Gallery's items property to "colTest2", but it still seems to be empty.

     

    jharville_2-1629470460564.png

     

    Does this mean the error lies somewhere within my ForAll() statement near the bottom of my code since nothing is being collected?

     

    Thank you!

     

  • jharville Profile Picture
    on at

    @v-jefferni 

     

    After extensive testing I still have no luck figuring out why my If() isn't collecting anything. Did you potentially see something that may be causing that issue?

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @jharville ,

     

    Could you please check whether the collection "info" has values in its Title column after selected multiple choices and clicked the button? You could add a blank screen, a gallery and set Items to info collection and a Label Text set to Title field.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 600

#2
WarrenBelz Profile Picture

WarrenBelz 478 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 322

Last 30 days Overall leaderboard