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

How do I hide a button if data in a gallery missing

Hi,

I want to hide a button when data is missing from a gallery but struggling to find the answer: I want to hide or disable the Save button if the tick box is ticked but no display name is selected. Not all rows will have the tick box selected so I only want the button hidden/disabled when the tick box is ticked and no employee has been chosen in the display name dropdown. The display name dropdown only displays when the checkbox is ticked:
the formula I have tried on the Visible variable is: If(IsEmpty(Filter(SearchResultGallery.AllItems,"ID"="ID1",!IsBlank(inputRecdDel.Value)&amp&amp !IsBlank(RecdEnterName.Selected.DisplayName))),true,false)

This returns no error but does not hide the button.

Can anyone help?
Many thanks
Mike

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: How do I hide a button if data in a gallery missing

Hey @mikiepat 

 

You can set the Visible property of the button outside the gallery as:

If(CountRows(Filter(Gallery3.AllItems,Checkbox2.Value && IsBlank(ComboBox1.Selected.Value1))) > 0, false,true)

Here, Gallery3 is the name of gallery control, checkbox2 is the name of checkbox inside the Gallery and Combobox1 is the name of the combobox control.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

6 REPLIES 6
Super User
Super User

Re: How do I hide a button if data in a gallery missing

You want it to hide or disable the save icon if ANYTHING in the gallery has that checkbox selected or if the one you are currently on? 

 

If you have the icon outside the gallery the icon looks at the gallery as a whole so you either have to do a Gallery.AllItems or Gallery.Selected...you can do an if statement to do AllItems but only certain also if you need that.

 

Also, if the save button is outside the gallery what it is doing...patching the selected item? 

Community Support Team
Community Support Team

Re: How do I hide a button if data in a gallery missing

Hi @mikiepat ,

 

Did you mean that you have inserted a people picker dropdown and a submit button control inside the template part of the gallery control? If so, then please set below formula in the Visible property of button control:

If(CheckBox1.Value=true&&!IsBlank(DataCardValue1.Selected),true,false)

 

Regards,

Mona 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mikiepat
Level: Powered On

Re: How do I hide a button if data in a gallery missing

Hi Rebeccas,

 

The Save icon is outwith the gallery and yes i want to disable it if anything in the gallery has the checkbox selected and yes the Save button is patching the items to a SharePoint list, here is formula:

ForAll(RenameColumns(SearchResultGallery.AllItems,"ID","ID1"),Patch(SPList,LookUp(SPList,ID=ID1 && Status="Delivered to Office"),{Status: If(inputRecdDel.Value=true,"Office Received"),RecdBy: RecdEnterName.Selected.DisplayName,Received: inputRecdDel.Value}));Refresh(SPList)

 

thanks

 

Mike

Dual Super User
Dual Super User

Re: How do I hide a button if data in a gallery missing

Hey @mikiepat 

 

You can set the Visible property of the button outside the gallery as:

If(CountRows(Filter(Gallery3.AllItems,Checkbox2.Value && IsBlank(ComboBox1.Selected.Value1))) > 0, false,true)

Here, Gallery3 is the name of gallery control, checkbox2 is the name of checkbox inside the Gallery and Combobox1 is the name of the combobox control.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

mikiepat
Level: Powered On

Re: How do I hide a button if data in a gallery missing

Thanks @yashag2255 !

 

That works! so i have updated the Visible property to: If(CountRows(Filter(SearchResultGallery.AllItems,inputRecdDel.Value && IsBlank(RecdEnterName.Selected.DisplayName))) > 0, false,true)

 

Your help is much appreciated!

 

Mike

mikiepat
Level: Powered On

Re: How do I hide a button if data in a gallery missing

Hi @v-monli-msft 

 

Thanks for your reply, your solution partially worked: if the checkbox was selected but no display name was selected then the save button was visible. The save button was only hidden when the display name dropdown was selected.

 

Thanks for your response

 

Mike

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 (5,508)