cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mikiepat
Helper III
Helper III

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
yashag2255
Dual Super User II
Dual Super User II

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
rebeccas
Super User
Super User

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? 

v-monli-msft
Community Support
Community Support

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.

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

yashag2255
Dual Super User II
Dual Super User II

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

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (20,722)