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 / ShowColumns/DropColumn...
Power Apps
Answered

ShowColumns/DropColumns based on ComboBox.SelectedItems or Concat(ComboBox.SelectedItems)

(0) ShareShare
ReportReport
Posted on by 174

Hi There,

 

hoping this forum can help. I'm trying to create a canvas app from a table that has a standard set of features (under heading features, the list of features then in a row of column A) and then each corresponding column is a technology (where the column heading is the name) that either has a yes or no in that column corresponding to the row of the feature, like this:

FeatureTech ATech BTech C
Feature 1YesNoYes
Feature 2NoNoYes

 

what i'm trying to do is let the user select the tech they want to see a comparison of via either checkboxes or a combo box (combo box made more sense to me) and then create either a gallery or table in PA to then spit out into HTML. 

 

its essentially a case of dropping/showing columns of the data source depending on whether the column is selected or not. I've tried both drop and show columns, but neither want to add or remove based off either the combobox input directly (using ComboboxName.SelectedItems.Value) or the Concat of the Combobox (using Concat(ComboboxName.SelectedItems,Value,",")). I have been able to successfully run an IF function out of the Concat to feed into... something... using initially the Concat, then If(Find("Tech A",ConcatLabel.Text)=1,"Tech A") but this still won't feed into either a drop column or show column.

 

also been trying to think of ways to do this in flow as well as PA, but still coming up blank. any help?

 

Thanks,

 

Alex.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Alex_Security 

    So, this is relatively challenging in PowerApps (from a table perspective).  The reason is that you are trying to dynamically change a record schema, and you can't do that in PowerApps.  You're also trying to reference a column by its text name...this also cannot be done in PowerApps.

     

    Now, that said...you can do many ways to get around it, but it takes some work.

     

    Consider the following - a ListBox (I used a list box as it was easier to manipulate, combobox works fine too). with the names of the Columns you want to view in it.  In your case: ["TechA", "TechB", "TechC"]

    In a Gallery, the following Formula:

    ForAll(
     yourData,
     {Feature: Feature,
     Columns: 
     Concat(Sort(["TechA", "TechB", "TechC"], Value), 
     If(Value in Sort(ListBox1.SelectedItems, Value), Value & "|" & 
     Switch(Value,
     "TechA", TechA,
     "TechB", TechB,
     "TechC", TechC
     ) & "~"
     )
     )
     } 
    )
     

    You can see the above it the manual part and painful if there are a lot of columns.

     

    Now, in the Gallery, a Label with ThisItem.Feature for the Text property.

    And a horizontal Gallery in the Vertical gallery with an Items property of: 

    Filter(Split(ThisItem.Columns, "~"), !IsBlank(Result))

    In the Horizontal Gallery, a label with the text property of : Last(Split(ThisItem.Result, "|")).Result

     

    To give it a header, another Gallery, outside of the main one and on top.  Gallery Items property set to:

    SortByColumns(ListBox1.SelectedItems, "Value")

    And a Label in the Gallery with the Text property of : ThisItem.Value

     

    Final result is this:

    alex_security.gif

     

    I hope I read what you were looking for properly and that this is helpful for you.

     

  • Alex_Security Profile Picture
    174 on at

    Hi @RandyHayes, so gave that a test and it does indeed work. I'm working on a mobile app so the horizontal layered galleries were tricky, but i've also now worked out a HTML template using IF functions on the FIND of the Concat label, but your solution is about a million times more elegant! 

     

    thanks so much! 

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 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard