Announcements
Has anyone ever hidden a column in a Data Table in a canvas Power App based on the absence / presence of values?
Like, when the user changes a filter on a Data Table such that the current set of records have no value in text Column 4...hide that field? And show it when it again contains text values with length > 0?Doesn't seem like a "thing" but wanted to check just in case.Thanks!
@breck
Yes, the column has a Visible property on it, you can set it to true or false as needed.
I hope this is helpful for you.
Go to the Visibility property and set it to either true or false. If you have a variable you can also use the variable in this property to control the visibility.
Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.
LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/ YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg Twitter: https://twitter.com/phipps0218
Sorry, should've specified that I'm looking for some kind of syntax example.Here, SSCC_Column1 is a text field in the data table, and apparently I can't get this syntax correct.I've tried referencing the data table column (as I'm trying here) and also the data source field itself:(Max(Len(SSCC_Column1)) > 1)This is something I'm trying in the function for the Visible property.Thanks.
Is it that you are trying to automatically hide columns if there is no value in any record for that column? If so, then you need to reference the datasource with your formula.
i.e.
CountRows(yourDataSource, !IsBlank(thisColumnName))>0
This is all an example...the yourDataSource needs to be the Items of your datatable and...this would not be delegable, so if you are dealing with more records than your record limit set in the app, then another solution is needed.
So...my problem might be that if I throw something like this at it (just my current flailing around):If(CountIf(FirstN(sqlSourceData,10), !(IsBlank(sqlFieldName))) > 0, true, false)(with FirstN() there to try to take an early look and not bog down on record count)Really, my problem is that I've gotten my focus off of the Data Table (where the user has applied one to many filters on the source) and am targeting the source data. The current data as displayed in the Data Table may or may not have data displayed in my target column, depending on what filters the user currently has in place. And that's when I want to hide or show that column in the Data Table--show it when his/her filters cause it to reflect contents, and hide it when those filters won't.I could do some cludgier things to get this to happen, but it just requires my function to "know things it shouldn't" and I'd really rather rely on a simple look at any N of the currently-displayed values in that column to see if any of them have values with length > 0. If they do, then show, and hide if not.This just may not be something attainable in the way I'm currently thinking about it.
Well, you're kind of talking about two different things (If I am reading it correctly), you are referring to a filtering ability and at the same time a show/hide capability for the table.
How does one impact the other? Or, are they simply two different things?
When you refer to "target column" what do you mean by that?
Filtering ability already in place. Performed by the user on the Data Table."Target column" to mean the column I'd like to show/hide based on whether the user's current set of filters causes non-zero-length data to appear in that column or not.
I'm not clearly understanding how the target column relates to the filter because I have no idea what your filtering is looking like and how it is designed.
Is it possible to provide a screenshot of that?
So, this seems to be working now:If(CountIf(FirstN((Filter(sqlSourceData, LineID = ddlLines.Selected.LineIDAnd (!(toggleSpecDate.Value) Or ProducedDateText = Text(DatePicker1.SelectedDate, "mm/dd/yyyy"))And (!(toggleSpecProduct.Value) Or ProductCode = ddlProducts.Selected.ProductCode)And (txtFilter1.Text = "" Or txtFilter1.Text in LotNumber))),10), !(IsBlank(sqlFieldName))) > 0, true, false)I'm brand-new to Power Apps and I think one of my problems has been that there's not going to ever be the equivalent of a "DataTable1.CurrentData" property, where CurrentData would be the source (sql) data as currently displayed and filtered by the user.I'm always going to have to go "back to the well" and use my source data with all the relevant filters applied. There's probably a way to create a variable or something that represents everything above supplied as the first parm to FirstN(). That would be cleaner than dragging around all these filters every time I wanted to represent the currently-displayed data someplace, and I could just change things in one place.Anyway, thanks so much for the help!
Yes...you are stating that you are having to repeat the formula of your Items property of the datatable each time!
There is a way to do this. It is very little known in PowerApps! It is what I call a dynamic record variable.
There are steps involved in creating one - something you are interested in knowing?? I can elaborate.
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.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 358 Most Valuable Professional
11manish 214 Super User 2026 Season 2
Mohsin Ali 185