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 / Conditionally Show fie...
Power Apps
Answered

Conditionally Show fields in Gallery

(0) ShareShare
ReportReport
Posted on by 1,146

Thank you for taking the time to read my question.

 

I have a table with many columns. I want to show the results in a Gallery, however at any given time, some columns are useful and others are not.

 

Is there a way to allow the user to select what columns they want to see and hide the rest?

 

I tried the following but PowerApps doesn't like it... I did 🙂

 

ForAll(colFields As tVal,If(!IsBlank(LookUp(colFields,tVal.tFields = tFields)),UpdateContext({"varVis" & tVal.tFields:true}) ,UpdateContext({"varVis" & tVal.tFields:false})))

 

I was thinking I could make up the Context variable name on the fly based on a string and the current value in the ForAll, but that's failing. Of course I can't use Set() either.

 

Is this possible?

 

Thanks

Categories:
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @iwonder 

    You cannot reference column names like that.  They must be hand-written in the formula as they are.

    I'm not sure what your collection is, but you can also do all of this from a combobox of column names.

     

    Example, A combobox with all the column names listed in it and the user could select from them to turn them on and off.

    Combobox Items property:  ["Column1", "Column2", "Column3"]

    If you want them all to be visible when you first access the screen, then set the DefaultSelectedItems property to: ["Column1", "Column2", "Column3"]

     

    Then in your gallery, for the columns you want to control, set the visible property to (example Column1): "Column1" in comboboxName.SelectedItems

    Repeat for the other columns with their names.

     

    That should give you what you want.

    I hope this is helpful for you.

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @iwonder If it is just to display data, you can use a DataTable and set the Visible property of the Data Table Column to true/false depending on the user selection.

    CNT_0-1639001076476.png

     

  • iwonder Profile Picture
    1,146 on at

    I was WAY over thinking it.... Thanks Randy.

     

    I guess the next issue would be to try and get the fields to float to the left...

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @iwonder 

    Keep it super simple!! Always a rule in PowerApps!

     

    You can alter the X properties for the controls you want to move around based on conditions.

    I am not sure of your floating needs, but I am guessing that you want to have all the controls line up horizontally with no spacing between them if the field between them is not visible?

     

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 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard