Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

On date change, set variable to false

(0) ShareShare
ReportReport
Posted on by 802

Hi,

 

I am really struggling with this one. 

 

I have a toggle which, on UnCheck, does this...

 

Clear(GFTS);
Set(GFBanks, false)

 

Clear being to clear the collection which is used in a gallery. All OK. It then sets the variable of GFBanks (which is a collection of checkboxes) to false. This works fine. 

 

What I want is for the same to happen when someone changes the date on the date picker, but I can't get this to work. I have tried exactly the same code on the OnChange property of the date picker, and it is performing the Clear command as the gallery goes blank, but is does not uncheck the checkboxes which the toggle does as per the Set command. 

 

Any ideas how to resolve?

 

Thanks

K. 

Categories:
  • Verified answer
    TheRobRush Profile Picture
    TheRobRush 11,121 on at
    Re: On date change, set variable to false

    Set every checkbox to have a value in its reset section called (for example)

     

    GFBankReset

     

     

    resetoiptiojn.PNG

     

     

    then in the change of the datepicker, after you have cleared GFBanks add in

     

    Set(GFBankReset,true);
    Set(GFBankReset,false)

     

  • Kosenurm Profile Picture
    Kosenurm 802 on at
    Re: On date change, set variable to false

    Default value for each checkbox on Ground Floor is "GFBanks".

  • Kosenurm Profile Picture
    Kosenurm 802 on at
    Re: On date change, set variable to false

    For the toggle, this sets all the checkboxes to true OnCheck and gives them an ID for use in the gallery (just an internal name for the bank of desks) and then sets the variable for the gallery to true. 

     

    On UnCheck of the toggle, it sets the checkboxes to false, and the variable to false to clear the gallery.

     

     

     

    ONCHECK
    ClearCollect(FFTS,{selection:'1FA-A'.Value,ID:"Bank A"}, {selection:'1FA-B'.Value,ID:"Bank B"}, {selection:'1FA-C'.Value,ID:"Bank C"}, {selection:'1FA-D'.Value,ID:"Bank D"}, {selection:'1FA-E'.Value,ID:"Bank E"}, {selection:'1FA-F'.Value,ID:"Bank F"}, {selection:'1FA-G'.Value,ID:"Bank G"}, {selection:'1FA-H'.Value,ID:"Bank H"}, {selection:'1FA-I'.Value,ID:"Bank I"}, {selection:'1FA-J'.Value,ID:"Bank J"}, {selection:'1FA-K'.Value,ID:"Bank K"}, {selection:'1FA-L'.Value,ID:"Bank L"}, {selection:'1FA-M'.Value,ID:"Bank M"}, {selection:'1FA-N'.Value,ID:"Bank N"});
    
    Set(FFBanks, true);
    
    
    ONUNCHECK
    
    Clear(FFTS);
    Set(FFBanks, false)

     

     

     

     This is fine for all or nothing. 

     

    When someone selects just one or a couple of the checkboxes, however, the OnCheck and UnCheck for each is... 

     

     

    ONCHECK
    
    Collect(FFTS,{selection:'1FA-J'.Value,ID:"Bank J"})
    
    ONUNCHECK
    
    Remove(FFTS,First(Filter(FFTS,ID="Bank J")))

     

     

     

    What I need is, for any time the user changes the date on the date picker, all checkboxes get cleared to unchecked and so the gallery gets cleared. 

     

    Thanks for you help

    K.

  • PowerRanger Profile Picture
    PowerRanger 3,458 on at
    Re: On date change, set variable to false

    @Kosenurm could you provide a Screenshot of your app as I am not sure what you are trying to do with the checkboxes. Maybe you could also provide a Screenshot of the collection with the checkboxes.

     

     

  • TheRobRush Profile Picture
    TheRobRush 11,121 on at
    Re: On date change, set variable to false

    If the checkboxes are within your gallery you may have to throw in a Reset(galleryname) at the end after the variable has been set

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard