cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted

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
Highlighted
Helper V
Helper V

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

Highlighted
Anonymous
Not applicable

Is there really no solution to my problem?

Highlighted

Hi,

 

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

 

Highlighted
Anonymous
Not applicable

Which form do you mean? The menu overview?

Highlighted

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?

Highlighted
Anonymous
Not applicable

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

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

Highlighted

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.

Highlighted
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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,359)