cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Karl_Hirschle
Level: Powered On

Show/hide a component with a button

Hi !

 

I'm trying to do something like this:

- A screen is loaded with a datatable invisible;

- The user fill a textinput with something he wants to see;

- When clicking a button, the datatable will show and filter that textinput term digited.

 

I'm trying first just to make a button that shows that table, so, i let the datatable visible option in off:

image.png

 

and in the button onselect, i tried:

 

image.png

 

But, when i run the application and click on the button, nothing happens. The table doesn't show up. 

Any help?

 

 

Thank you ! 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft dinusc
Microsoft

Re: Show/hide a component with a button

The reason it does not work is because your DataTable4.Visible property it is set to "false" so your button action is simply ignored. What you need to do is to set it to a variable ans then set that variable by your button action:

Screen1.OnVisible=Set(v.false)

YourButton.OnSelect=Set(v, true)

DataTable4.Visible=v

The first formula will set the visibility to false by default every time you navigate to your screen.

Clicking on a button will set it to true and the DataTable visibility is bound to the visibility variable.

View solution in original post

19 REPLIES 19
Microsoft dinusc
Microsoft

Re: Show/hide a component with a button

The reason it does not work is because your DataTable4.Visible property it is set to "false" so your button action is simply ignored. What you need to do is to set it to a variable ans then set that variable by your button action:

Screen1.OnVisible=Set(v.false)

YourButton.OnSelect=Set(v, true)

DataTable4.Visible=v

The first formula will set the visibility to false by default every time you navigate to your screen.

Clicking on a button will set it to true and the DataTable visibility is bound to the visibility variable.

View solution in original post

Karl_Hirschle
Level: Powered On

Re: Show/hide a component with a button

Thank you !!!!!

Karl_Hirschle
Level: Powered On

Re: Show/hide a component with a button

Hi ! I'm still having problems. The show/hide suggestion worked very well !

As i said, i want too to filter the data.

 

I have a textinput called "pesquisa" and a datatable called DataTabel1 that has two collumns: "colaborador" and "capacitacao

 

I tried insert/datatable and, on button select, i wrote:

Set(b, pesquisa.Text);
Filter(capacitacoes_dados_teste, b in colaborador) but the debbuger returns me a error saying "expected a text value" instead of colaborador. But this is the name of my column. Some help?

Microsoft dinusc
Microsoft

Re: Show/hide a component with a button

This is most likely because colaborador is a record. Try to type a "." after it to see if intellisense provides value names for you.

Your formula has to be something like

Filter(capacitacoes_dados_teste, b in colaborador.Value)

Karl_Hirschle
Level: Powered On

Re: Show/hide a component with a button

Doens't worked 😕

.value isn't available.

Karl_Hirschle
Level: Powered On

Re: Show/hide a component with a button

I tried another column and this error appeared:

 

Sem título.jpg

Microsoft dinusc
Microsoft

Re: Show/hide a component with a button

Just so I understand, you have a data source "capacitacoes_dados". That data source has a column "colaborador". You also have a DataTable with 2 columns: "colaborador" and "capacitacao".

You also have a button and a text field. What you want to do is to fill the DataTable control with the data from your source (capacitacoes_dados) which is filtered by the "colaborador" column based on the text value from your text field. If so then the following should work:

YourButton.OnSelect=Set(col, Filter(capacitacoes_dados_teste, pesquisa.Text in colaborador))
DataTable1.Items=col

The reason you see the delegation warning is most likely because of the "in" operator that cannot be delegated by your source connector. What this means is:

If your source contains more records than the maximum allowed by the connector (500 by default that can be changed to 2,000) then you may not get the proper results. If you have less records then you may safely disregard the warning. If you have more records then you will have to ensure that you use only delegable functions and operators in your formula. Please see more details here:https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-list

Karl_Hirschle
Level: Powered On

Re: Show/hide a component with a button

Exactly what you said !!!

 

Datatable.items isn't available and the software gives a error on colaborador, saying: Expected text value.

Microsoft dinusc
Microsoft

Re: Show/hide a component with a button

ok. Let's start with the first issue: "Datatable.items isn't available"

Please see the screenshot below. Do you see the "Items" property in the Advanced Properties panel?Capture.PNG

 

 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (3,301)