cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sasker
Regular Visitor

ShowColumns - hidd

Hi,

I'm building a a project dashboard overview, where all information is stored in a list. I'd like to be able to display a subset of the columns in this list in a Powerapps Table or Display Form (or any other solution that would allow me to to display a subset of the underlying list in one view).

This is a snapshot of the list:

DummyList.png

I can display the full List in a table by linking this list (DummyList) as data source, or by setting Item = DummyList

Full.png

At the moment, I'm using a table to display a subset of the list columns using the ShowColumns function, as explained here. Note that using the ShowColumns function results in displaying only the desired columns.

However, when I use this function [Items = ShowColumns(DummyList,"Title", "Column2")] on a table, I still see all the headers of the list displayed (even if I did not mention these columns in the ShowColumns function). My guess is that I am doing something wrong, but I do not know what.

Table.png

As an alternative, I tried calling this function on a Display Form, but this throws an error. I could select the columns to be displayed manually  via "Edit Fields," but I want the information to appear automatically or via a programmatic way.

Display.png

 

Last thing I tried, was creating a collection via a button with [OnSelect = ClearCollect(MyCollection, ShowColumns(DummyList, "Title","Column2"))]. However, when I use this collection as datasource for a Table or Display Form, it seems I have to select the columns to display manually via "Edit Fields".

Collection.png

I'm quite new to Powerapp, but have been looking for an answer to this topic for some time now and can't solve it myself - any help on this would be highly appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
MarvinBangert
Memorable Member
Memorable Member

Hey @Sasker 

you can use a context variable to change the visible function within your columns:

I created a button with OnSelect:

UpdateContext({varVisible: !varVisible})

Select the column within your DataTable and change the "visible" state to "varVisible":

Image 608.png

Image 609.png

If you click on the button, the columns will be shown or hidden.

Image 610.pngImage 611.png

 

Hope this will help you.

 

Regards

Marvin

View solution in original post

4 REPLIES 4
MarvinBangert
Memorable Member
Memorable Member

Hey @Sasker 

you can use a context variable to change the visible function within your columns:

I created a button with OnSelect:

UpdateContext({varVisible: !varVisible})

Select the column within your DataTable and change the "visible" state to "varVisible":

Image 608.png

Image 609.png

If you click on the button, the columns will be shown or hidden.

Image 610.pngImage 611.png

 

Hope this will help you.

 

Regards

Marvin

v-yutliu-msft
Community Support
Community Support

Hi @Sasker ,

Do you want to only display "Title", "Column2" of your list in the data table?
The reason why you met this problem is that you didn't choose the columns that you want to display when you use ShowColumns function.

Every time you set items of data table, you need to choose the columns that you want to display.

The columns displaying in the data table will not be updated automatically.

Here's my solutions:

1)delete your original data table, insert a new data table.

set the new data type's Items:

ShowColumns(DummyList,"Title", "Column2")

Then the new data table will only display the Title and Column2 field. It will not retains the old one's data.

 

2)If you still want to use original data table, after you change the data table's Items, you need to reselect fields to display.

For example: 

First time, set the data table's Items:DummyList

Then, change the data table's Items: ShowColumns(DummyList,"Title", "Column2")

Then, reselect the fields to display.

203303.PNG

 Remove all the fields that you do not need any more, just retain those you want: "Title", "Column2".

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Marvin! That worked right away!!!

Hi Phoebe, 

Many thanks for your fast feedback!

You solution explains the functioning of ShowColumns very clearly. However, it requires still a manual step in the app creation phase to select the columns that should be visible, while I actually wanted to give the end user control of which columns are visualized; therefore I selected Marvin's solution in the end.

Kind regards,
Sasker

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,123)