web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps | To reset ...
Power Apps
Answered

Power Apps | To reset controls in the gallery, including the calculated number input control

(0) ShareShare
ReportReport
Posted on by 44
Hi,

I have a gallery setup with a number of controls which allow users input.  I want to reset all input and the calculated Number input control.
 
Seems the "reset" does not work inside gallery.  Not sure where to fix while I am not linking the collections to any database.. but simply setup controls for users to input.  Please help.
 
 
I have the following set in the dropdown box (On change) :
 
+++++++++++++++
ClearCollect(
    colHotels,
    ForAll(
        Sequence(Value(ddHotelCount.Selected.Value)),
        {
            HotelName: "",
            RoomCategory: "",
            Currency_1: "",
            CostPerNight: 0,
            TaxPercent: 0,
            Nights: 0,
            Currency: "",
            SubTotal: 0
        }
    )
)
++++++++++++++
 
For the calculated control, I have set the value as below:
 
If(
    IsBlank(CostPerRoomNight.Value) || IsBlank(NoNights.Value) || IsBlank(Tax.Value) ||
    CostPerRoomNight.Value = 0 || NoNights.Value = 0 || Tax.Value = 0,
    Blank(),
    CostPerRoomNight.Value * (1 + (Tax.Value)/100) * NoNights.Value
)
Categories:
I have the same question (0)
  • Suggested answer
    DJ_Jamba Profile Picture
    2,837 Moderator on at
    If you want to reset controls in a gallery, bind their default values to variables, then reset the gallery.
  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    If your question is simply how to Reset controls in a Gallery, set the Reset property of each relevant control to a Variable (I will use varReset here). Then when you want to reset, toggle the Variable
    UpdateContext({varReset: true});
    UpdateContext({varReset: false});
    and the controls will reset.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    Visit my blog Practical Power Apps    LinkedIn   
  • WingC Profile Picture
    44 on at
    Thank you  and  ,
     
    One of my control is a number input, I do not see a "default" field for me to set variable. 
     
    I've tried to get a text input (but formatted as number), I am not sure where I could set my formula.  I put this at On.Select, seems the user need to click the box before reflecting the calculation. 
     
    I have formula to calculate the hotel cost:
     
    If(IsBlank(CostPerRoomNight.Value) && IsBlank(Tax.Value) && IsBlank(NoNights.Value),
    Blank(),
    CostPerRoomNight.Value * (1 + (Tax.Value)/100) * NoNights.Value)

    Please let me know in case you have better option to handle this.
     
    Thank you.
    Best,
    Wing
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
     I assume now that you are using Modern controls - if so, then this property has not been included - what I posted works fine on a Classic Text Input. Making the Default a Variable also would be problematic as it would set the control in every row of the gallery to the same value.
    If you really need this function, you may have to revert to classic controls here (I have yet to use any Modern controls in any Prod apps).
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    Visit my blog Practical Power Apps    LinkedIn   
     
     
  • WingC Profile Picture
    44 on at
     
    Thank you very much for your swift reply.  I have reverted to classic one and do I set my calculation at OnSelect Property?  That would require users to click the control before reflecting the answer right?  

    Can I set both the calculation and variable at the Default?  What would be the coding?  
     
    ** Forgive me to ask stupid question as I am not an advanced developer. :)
     
    Thank you.
     
    Best,
    Wing
  • WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    The Variable needs to go on the Reset property of the control/s that you want reset I assume all of those that contribute to the value in the calculated control). The code I posted goes directly after the Collect code you posted.
     
    Please ✅ Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like♥.
    Visit my blog Practical Power Apps    LinkedIn   
  • WingC Profile Picture
    44 on at
    Thank you .  This is helpful.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard