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

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
Mike8
Level 10

Re: Reset Checkbox in nested Gallery

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

11 REPLIES 11
Lisabel0
Level 8

Re: Reset Checkbox in nested Gallery

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

uhlme
Level: Powered On

Re: Reset Checkbox in nested Gallery

Is there really no solution to my problem?

panand99
Level 10

Re: Reset Checkbox in nested Gallery

Hi,

 

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

 

uhlme
Level: Powered On

Re: Reset Checkbox in nested Gallery

Which form do you mean? The menu overview?

Mike8
Level 10

Re: Reset Checkbox in nested Gallery

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?

uhlme
Level: Powered On

Re: Reset Checkbox in nested Gallery

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

uhlme
Level: Powered On

Re: Reset Checkbox in nested Gallery

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

Mike8
Level 10

Re: Reset Checkbox in nested Gallery

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.

uhlme
Level: Powered On

Re: Reset Checkbox in nested Gallery

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
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,265)