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 / Connecting buttons to ...
Power Apps
Unanswered

Connecting buttons to Gallery

(0) ShareShare
ReportReport
Posted on by 42

Hello, I´m trying really hard to connect this data, but it´s taking a long time and a lot of stress and I just came to the point that I give up.

The issue is pretty "simple".

I have a screen, with a vertical gallery, called "Gallery2" which is connected to a Sharepoint list, called "General". 

Here the Sharepoint list:

mtere_0-1696006657665.png

 

Here, my screen on Power App:

mtere_1-1696006844631.png

As we can see we have a blue button on the top, called "21 bis dach" which is a category.

I want  to filter the gallery based on the "Category 2" column of Sharepoint. 

For example: I press the button "21 bis dach" and the gallery shows me only the titles related on that category.

But there is a problem: I can´t connect the gallery to the button because, apparently, category1 and category2 just don´t exist in the edit field section. 

On "OnSelect" property of the button I wrote: "UpdateContext({Filterby21bisdach:!Filterby21bisdach})".

On "Items" property of the Gallery, I wrote: "SortByColumns(Filter(General), If(Filterby21bisdach=true, Category2.Text = "21 bis dach", Category2.Text<>""))" but it gives me error. The error messages are:

-Invalid number of arguments, received 1, expected 2 or more

-The function "SortByColumns" has some invalid arguments

-Invalid argument type (Boolean); Expecting a text value instead 

 

Thank you in advance for your help. 

 

 

 

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at

    Hi @mtere 

     

    The SortByColumns function can also be used to sort a table based on one or more columns.

    Is not use to filter the data so I change the code and this should work. 

     

    Try this code:

    If(
     Filterby21bisdach,
     Filter(General, Category2.Text = "21 bis dach"),
     Filter(General, Category2.Text<>"")
    )

     
    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • mtere Profile Picture
    42 on at

    Hello SpongYe and thank you so much for you suggestion.

    I used your code and I got this error on ".Text": "Name isn't valid. 'Text' is not recognized'".

    I try to Google it but I got no solutions. 

    Do you have any idea?

     

  • SpongYe Profile Picture
    5,883 Super User 2026 Season 1 on at

    Hi @mtere 

     

    Is Category2 a textinput control?

    If it is a dropdown please use the following code:

    If(
     Filterby21bisdach,
     Filter(General, Category2.Selected.Value = "21 bis dach"),
     Filter(General, Category2.Selected.Value<>"")
    )


    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • AndrewR1 Profile Picture
    1,572 Moderator on at

    Hi @mtere and @SpongYe I think because they are using Multi Selection choice field for there category's you will need to use the !IsBlank and in operators for the conditions: 

     

     

    If(
     Filterby21bisdach,
     Filter(General, "21 bis dach" in Category2.Selected.Value),
     Filter(General, !IsBlank(Category2.Selected.Value))
    )

     

     The only issue you will face is this will cause delegation warnings as long as the row limit is set to 2000 and you will not exceed the 2000 row limit when collection your data this should be fine! 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. Remember, you can accept more than one post as a solution. If the content was useful in other ways, please consider giving it Thumbs Up.


    Thanks
    Andrew

  • mtere Profile Picture
    42 on at

    Thank you both, @SpongYe and @AndrewR1 for your help 🙂

    I used both codes, I tried to make some changes; for some reason, there are issues. 

    I have a dropdown menu, with the Display Mode set to "View". The name of this dropdown menu is "Dropdown3".

    This dropdown menu is connected with the "Category2" column from my Sharepoint list. In fact, we can see that we have the text "21 bis dach" over there. 

    That´s how it looks like:

    mtere_0-1696431955083.png

     

    I used this code on the Items section of the main Gallery:

     

    If(
     Filterby21bisdach,
     Filter(General, Dropdown3.Selected.Value = "21 bis dach"),
     Filter(General, Dropdown3.Selected.Value <> "")
    )

    "General" is the name of the Sharepoint list, Dropdown3 is the name of the dropdown menu. 

    The gallery is called "Gallery2" (for your reference).

     

    If you´re wondering if I twiched between "SelectedText" or "Text" instead of "Value" etc, and MANY others, my answer is YES, I did. 

     

    The error that I always got is this one: 

    mtere_1-1696432318430.png

     

    It´s getting way more complicated than expected... but I´m sure we can find a solution.

    I´ll accept any suggestion from your side. 

    Thank you again!!

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 414

#2
Valantis Profile Picture

Valantis 408

#3
timl Profile Picture

timl 339 Super User 2026 Season 1

Last 30 days Overall leaderboard