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 / Unable to add date to ...
Power Apps
Answered

Unable to add date to a collection from a datePicker's onChange

(0) ShareShare
ReportReport
Posted on by 11

PranayJadhav_1-1692533624434.png

PranayJadhav_2-1692533741931.png

I am selecting a value from dropdown for eg Today.

Converting it into date format , in the defaultDate property of the Date Picker.

and onChange of the Date Picker adding the date to the collection. 

Though the issue is that the collection remains empty as the onChange property is never called . 

Give me a solution to this ?

Categories:
  • MissingLink Profile Picture
    236 on at

    I suspect that you have defaulted the date to the same date that you are wanting the collection date to be.

    For example, you are setting the default date to Today() - so the user is not selecting a different date - so the On Change event never fires.

    To prove this theory, try change the date to another date, then change it back to the actual date that should be put into the collection.

  • PranayJadhav Profile Picture
    11 on at

    PranayJadhav_1-1692591527423.png

     

    I tried adding a complete different date but the collection still remains empty

  • MissingLink Profile Picture
    236 on at

    test

  • Verified answer
    MissingLink Profile Picture
    236 on at

    To test your code, I recreated what I think you have.

    I added a drop down list containing 'Today', 'Week To Date' and 'This Week'.

    I added a button with this code in the 'On Select'.

     

    UpdateContext({MyDate:
     Switch(Dropdown1.Selected.Value,
     "Today",DateValue("12/01/2016"),
     "Week to Date",DateAdd(Today(),-Weekday(Today(),StartOfWeek.Sunday)+2,TimeUnit.Days),
     "This Week",DateAdd(Today(),-Weekday(Today(), StartOfWeek.Sunday)+1,TimeUnit.Days)
     )});
    
    Collect(FromDataCollection,
    {
     Field:"Test Date",
     Operator: TextInputCanvas1.Value,
     Value: Text(MyDate),
     Type:"Date"
    })

    Does this solve your problem? 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard