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

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
Highlighted
Microsoft
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

20 REPLIES 20
Highlighted
Microsoft
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

Highlighted
Regular Visitor

Re: Show/hide a component with a button

Thank you !!!!!

Regular Visitor

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?

Highlighted
Microsoft
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)

Highlighted
Regular Visitor

Re: Show/hide a component with a button

Doens't worked 😕

.value isn't available.

Highlighted
Regular Visitor

Re: Show/hide a component with a button

I tried another column and this error appeared:

 

Sem título.jpg

Highlighted
Microsoft
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

Highlighted
Regular Visitor

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.

Highlighted
Microsoft
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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,847)