cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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 @Anonymous 

 

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
Community Champion
Community Champion

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 @Anonymous ,

 

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.
Anonymous
Not applicable

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 @Anonymous 

 

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!

Anonymous
Not applicable

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

Anonymous
Not applicable

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,952)