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

Reset Checkbox in nested Gallery

I do have the following scenario:

  • 1 screen with an overview of all kind of menus. The days displayed are a vertical gallery with a nested horizontal gallery to show the menus per day. The checkboxes on the screen are for a thing so called "multi-menu-order" for employees who want to order menus for the whole week.
    11-10-_2018_08-16-16.png
  • 1 screen for the multi-order which shows all selected menus from the previous screen in a horizontal gallery.
    11-10-_2018_08-17-56.png

 

Now the desired result would be: If I click on the back button I get to the previous overview and the selected checkboxes are still selected, which is the case. But if I click on the button "Order menu", the checkboxes should be resetted, which is currently not working.

 

Multiple Order Screen

  • Back Button
    11-10-_2018_08-21-03.png
  • Order Button
    ForAll(SelectedItems,Patch(
        MenuOrder,
        Defaults(MenuOrder),
        {
            Titel: "Mehrfachbestellung",
            MenuID: {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id: Value(Menü.ID),
                Value: Value(Menü.Title)
            },
            Anzahl:Value(AnzahlValue_1.Text),
            Verrechnung: VerrechnungValue_1.Selected,
            'verspätetes Essen':verspätetesEssenValue_1.Value,
            'Tisch reservieren':TischreservierenValue_1.Value,
            Bemerkungen:BemerkungenValue_1.Text,
            KostenstelleLU: {
               '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Id: Value(KostenstelleValue_1.Selected.Id),
                Value: Value(KostenstelleValue_1.Selected.Value) 
            },
            'Art der Verrechnung': DataCardValue42_1.Selected,
            Menüdatum: MehrfachbestellungDate
            
        }
    ));
    UpdateContext({ResetCheckbox:true});
    UpdateContext({ResetCheckbox:false});
    Notify(Switch(Language,"GER", "Danke für die Bestellung", "ENG", "Thank you for ordering", "FR", "Merci d'avoir passé commande"));
    Back()
    found here: https://powerusers.microsoft.com/t5/General-Discussion/Reset-Checkboxes-in-Gallery/m-p/101559#M37545

Menu Overview

  • Structure
    11-10-_2018_08-25-17.png
  • Checkbox Properties
    Default = false
    OnCheck =
    Collect(SelectedItems, {Menü:ThisItem,MehrfachbestellungDate:DateValue(glryDayMenüplan.Selected.lblMenüplanDateFormat.Text)})
    OnUnCheck =
    Remove(SelectedItems,{Menü:ThisItem,MehrfachbestellungDate:DateValue(glryDayMenüplan.Selected.lblMenüplanDateFormat.Text)})
    Reset = ResetCheckbox

Is it just not possible to reset checkboxes in nested galleries or is there anything missing from my side?

 

Cheers,

uhlme

1 ACCEPTED SOLUTION

Accepted Solutions

Yes, this is it. It works for me. Try it to your sample app.
You may need to change the name of your variable because you have a Global and a local variable with the same name.
btn.OnSelect = Set(ResetCheckbox1,true);Set(ResetCheckbox1,false)
And Checkbox.Reset = ResetCheckbox1

View solution in original post

12 REPLIES 12
Lisabel0
Helper V
Helper V

Personally I do not think this could be achieved. You have many variables to set on the checkboxes.

Anonymous
Not applicable

Is there really no solution to my problem?

Hi,

 

Are you resetting your form once you clicked on "Order Menu" button?

 

Anonymous
Not applicable

Which form do you mean? The menu overview?

Hello uhlme,

I have just created a new app.

It contains two galleries and a button.


Gallery1 contains a label control and Gallery2.
Gallery2 contains a checkbox control.
CheckBox1.Reset = vReset
Button1.OnSelect = UpdateContext({vReset:true});UpdateContext({vReset:false})

I click on random checkboxes and when I press the button they reset.
So the proof of concept is there. 
Can you try it in a new simple app? Does it work for you?

Anonymous
Not applicable

Do you do this on the same screen or is the button on a separate screen?

Anonymous
Not applicable

I tried the simple app as you mentioned. It works if the button and the other controls are on the same screen, as soon as I move the button to another screen it doesn't work anymore...

Hehe. Okay, got it.
Your button is on an other screen.
UpdateContext creates a local variable. You can use it only on the same screen.
You can use the Set() function to achieve what you need.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-set
If you need help, let me know.

Anonymous
Not applicable

Thanks for the help so far!

So the command would still be like this

btn.OnSelect = Set(ResetCheckbox,true);Set(ResetCheckbox,false)

And Checkbox.Reset = ResetCheckbox

I've tried that in the app and that didn't work...

 

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,895)