web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Display only non-blank...
Power Apps
Unanswered

Display only non-blank values from a record in a Gallery

(0) ShareShare
ReportReport
Posted on by 2

I created collection in Power Apps ("Coils"), whereby I've filtered my DataSource by a particular record chosen by the User (using a dropdown result):

 

ClearCollect(Coils,ShowColumns(Filter(DataSource,ID=DropDown.Selected.ID),"Col11","Col12","Col13","Col14",...,"Col25"));

 

The collection becomes a single row of data with many columns, and due to the nature of my DataSource, several columns/fields are expected to be blank. (However, I never know which are blank since the creation of the collection is dynamic.) My goal is to display only the non-blank values from the collection in a Gallery. I figure that somehow I need to specify the non-blank entries as the items in the Gallery, or create a second collection of only non-blank values.

 

Being relatively new to Power Apps, I thought about somehow filtering by columns to remove blanks, or somehow transposing the collection into a single column (then filtering). I also tried dynamically removing blanks from the collection, but couldn't determine how to loop through each field.

 

Any thoughts or ideas would be appreciated!

 

I

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @psharm5 ,

    Firstly, will not this code on only return one record (the ID selected)?

    ClearCollect(
     Coils,
     ShowColumns(
     Filter(
     DataSource,
     ID=DropDown.Selected.ID
     ),
     "Col11",
     "Col12",
     "Col13",
     "Col14",
     ...,
     "Col25"
     )
    )

    Putting this aside, which column is expected to be blank? Assuming for instance that Coll1 will be blank as the test

    With(
     {
     wData:
     Filter(
     DataSource,
     ID=DropDown.Selected.ID 
     )
     },
     ClearCollect(
     Coils,
     ShowColumns(
     Filter(
     wData,
     !IsBlank(Coll1)
     ),
     "Col11",
     "Col12",
     "Col13",
     "Col14",
     ...,
     "Col25"
     )
     )
    )

    Note the With() statement is only to avoid Delegation issues with the !IsBlank test.

     

    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. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at

    Hi @psharm5 ,

     

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

    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. If the content was useful in other ways, please consider giving it Thumbs Up.

  • psharm5 Profile Picture
    2 on at

    Yes, the code I specified in my question will return 1 record, with Col11 thru Col25 (part of a larger source table), depending on a user selected dropdown. (Note, as an aside, I've manually skipped Col1 thru Col10, since I know no other way to select only a range of columns using "ShowColumns").

     

    The returned record (now with 15 columns) will have several blanks throughout (depending on the record chosen in the dropdown), but I won't know which fields. What I'd like to display in a Gallery for an end-user are only the fields which are NOT blank. So, depending on the end-user's dropdown selection, the display items in the Gallery will change...  

     

    Can the retuned record be filtered somehow to remove the blank fields?

     

    Another thought is to concatenate the fields in the record using a "," delimiter, then using Split and Filter. But can the fields in a record be concatenated?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard