How to use button to display filtered data from excel table in PowerApps?

一曲冷凌霜 提交于 2021-01-29 07:30:56

问题


I am a newbie in PowerApps, and I am trying to build an app where based on user click, user should be able to see filtered data.My test data looks like below.For this I have created 3 button in my gallery titled as "Available", "Out-of-service" and "In-use". So, let's say when user clicks on "Available" button, the app should display the user "Sys1" and "Sys2". Likewise, same is true for "Out-of-service" and "In-use" button. I have my datasource save as ExcelTable in Onedrive and I was able to successfully connect to the source.However, when I tried below code on my "Available" button nothing happened.I am not sure what is the issue ? [SEE BELOW UPDATE]

If there is good tutorial available for this task feel free to attached link with your response.

Code

Filter(Table1,Column2,"Available" in Column2)

Note: Property: OnSelect

Update:

After little bit of research I found that I need to have separate screen to display my filtered data. So I used Navigate() function to take me to new screen. On my screen2 I have below code

Code:

Filter(Table1, column2="Available") 

Note: Property is set to "OnVisible". I also added FormViewer using Forms-> Display option. Then under Properties tab,I added column names using Edit fields.

Still Issue is not resolved!


回答1:


It sounds like you have the Filter command in the wrong place. It should be in the "Items" property for the table, not in the Buttons' or in the Screen's properties. The Buttons should toggle a variable to the different Statuses you have.

The Items property of the table/gallery/etc that shows the data would look like this:

Filter(Table1, Column2=currentStatus)

The buttons would all have code that looks like this but with different statuses:

Set(currentStatus, "Available")

That way when you click the buttons, the value of currentStatus changes and will change the action of the filter.

Also, you can have the data visible on the second screen if you want but it's not strictly necessary. You can do what I described on a single screen.



来源:https://stackoverflow.com/questions/63984559/how-to-use-button-to-display-filtered-data-from-excel-table-in-powerapps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!