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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Dropdown and date pick...
Power Apps
Answered

Dropdown and date picker resetting to default in gallery when saving line.

(0) ShareShare
ReportReport
Posted on by 12

Hello - I'm new to PowerApps, but I've been able to figure out a lot of things using this forum (thanks!) and google searches.  I'm building an expense report, which uses a form (for the report) and a gallery (for the line items), and I'm running into a snag that has me stumped.  

 

The gallery has a number of input fields: a DatePicker, a DropDown for category, and then a number of text fields.  When I save the row, the correct values are patching to the collection, BUT they reset to the default on the screen.  I can't figure out how to get the DatePicker and DropDown fields to retain their original value on the screen.  The user is going to think the wrong data will submit in the report.    

 

Here's the code that I'm using to patch the line to the collection and add a new line.  Anything jump out in there?

 

Patch(ExpenseCollection,ThisItem,{LineItem: InputItem.Text,LineCost: Value(InputCost.Text),Miles: Value(InputMiles.Text),MilesCost: Value(CalcMileage.Text),ExpDate:DatePicker1.SelectedDate,Category:Dropdown1.Selected.Value,ShowSaveButton:false}); Collect(ExpenseCollection,{LineItem:"",LineCost: 0,Miles: 0,MilesCost: 0,Category:"",ExpDate:Today(),ShowSaveButton: true})  

 

Or do I perhaps need to do something on the Dropdown and DatePicker properties?  I'm at a loss here.  

 

Thanks for any help you can offer!

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Figment98 

    What is the DefaultDate property set to on the DatePicker and what is the Default set to on the Dropdown?

  • Verified answer
    Figment98 Profile Picture
    12 on at

    Figured it out.  🙂  The Default on those needs to be ThisItem.ExpDate and ThisItem.Category.  No clue why, but it works now.  🙂  

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Figment98 

    Yep, that is where I was going!  When you change anything about the datasource (Items) of your Gallery, it will reevaluate the controls in it.  If they have no Default properties set, they will default to blank or something you don't want.  You have to set them.

     

  • Figment98 Profile Picture
    12 on at

    Yes, thanks for the explanation.  Appreciate it.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard