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 / How to make a Gallery ...
Power Apps
Unanswered

How to make a Gallery selectively shows sharepoint columns that are not blank?

(0) ShareShare
ReportReport
Posted on by 4
StateCar ColorHouse ColorFlowersPets
Floridared   
New York  tulipscat
Georgia blue dog

The table above is a sample of my database. As you can see, not every state has the same subtopics. Sometimes some states have data in them (Ex. Pets column, only Georgia and New York have data in it, the other state(Florida) is blank). My dilemma is, once the user selects a state(for example Florida from a dropdown box), how can I make a gallery to only pull the information from a sharepoint list where the columns are NOT empty, in a way where it displays the column header's name and its content below? am I asking too much from Power Apps ? I can get it to pull everything, but we dont want a bunch of empty results in between.

Categories:
I have the same question (0)
  • TylerPA Profile Picture
    201 on at

    One approach - to spread out in the information horizontally, you collect the information for your selected item as below. Then filter "displayGal" to remove any blank "thisVal" rows. The result is a gallery of titles and values

    ClearCollect(
    displayGal,
    {
    title: "State",
    thisVal: selected gallery items State value...
    },
    {
    title: "Car Color",
    thisVal: selected gallery items Car Color value...
    },
    {
    title: "House Color",
    thisVal: selected gallery items House Color value...
    }
    );

     

  • jdavila8091 Profile Picture
    4 on at

    Thanks for the response TylerPA. Could you give me an example how should i spread out the row and columns with the information provided? It would help me so much to understand it better.

  • TylerPA Profile Picture
    201 on at

    @jdavila8091 

     

    yep, no worries - below is setup pulling directly from sharepoint. could also be setup to work on a collection

     

    if this is your sharepoint list

    TylerPA_0-1669843619024.png

     

    dropdown box Items property

    TylerPA_1-1669845685242.png

     

    dropdown OnChange 

    ClearCollect(
    displayGal,
    {
    title: "State",
    thisVal: First(Filter(testList30Nov, state=Dropdown8.Selected.state)).state
    },
    {
    title: "Car Color",
    thisVal: First(Filter(testList30Nov, state=Dropdown8.Selected.state)).carColor
    },
    {
    title: "House Color",
    thisVal: First(Filter(testList30Nov, state=Dropdown8.Selected.state)).houseColor
    },
    {
    title: "Flowers",
    thisVal: First(Filter(testList30Nov, state=Dropdown8.Selected.state)).flowers
    },
    {
    title: "Pets",
    thisVal: First(Filter(testList30Nov, state=Dropdown8.Selected.state)).pets
    }
    );

     

    horizontal gallery Items 

    TylerPA_2-1669845805226.png

     

    and labels within the gallery, ThisItem.title, ThisItem.thisVal

  • Putte Profile Picture
    2 on at

    Hi.

     

    Managing the blanks in the gallery is pretty straightforward and here is an example. Just paste the code into the Items property of your gallery control and update the data source and dropdown control:

     

     

     

     

    Filter(Sort(Split(Concat(Filter(yourDatabase,State=yourDropDownControl.Selected.Result),

     

        If(!IsBlank('Car Color'),'Car Color' & ", ","") & 

        If(!IsBlank('House Color'),'House Color' &", ","") &

        If(!IsBlank('Flowers'),'Flowers' &", ","") &

        If(!IsBlank('Pets'),'Pets' &", ","")),", ")

     

    ,Result,Ascending),!IsBlank(Result))

     

     

     

     

    Fetching the column names in Power App is a little more tricky but here's a way to do it:

    Get Collection Column Names - Matthew Devaney

     

     

    I hope this solves your challenge.

     

     

     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 993

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 545

Last 30 days Overall leaderboard