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 Patch Collec...
Power Apps
Unanswered

Unable to Patch Collection (A Record's Blank Date Field) from DatePicker

(0) ShareShare
ReportReport
Posted on by 149

For some reason, no matter what I do, I can't get my OnSelect to patch any type of value (data, text, value) to a blank date field in a record of a local collection.

 

The local collection is called cpaDB and it is generated by importing an Excel table into PowerApps.  The collection shows up perfectly in my gallery.  When I try to update a date value in it, nothing happens.

 

  • Formula 1: Patch(cpaDB,ThisItem,{'CA-MD-Lic-Exp': DatePicker2.SelectedDate})

 

I have tried patching the exact same DatePicker to a text field and that works so I then tried

 

  • Formula 2: Patch(cpaDB,ThisItem,{'CA-MD-Lic-Exp': Text(DatePicker2.SelectedDate)})

 

To see if my CA-MD-Lic-Exp field was being read as text instead of a date, but then i get an error of:

"The type of this argument 'CA-MD-Lic-Exp' does not match the expected type 'DateTime'. Found type 'Text'."

 

Considering it would do NOTHING with the above Formula 1, and it throws an error with Formula 2, I went ahead and tried passing it as a value, which (as expected) didn't do anything to help.

 

I then tried to use DateTimeValue()

  • Formula 3: Patch(cpaDB,ThisItem,{'CA-MD-Lic-Exp': DateTimeValue(DatePicker2.SelectedDate)})

But this said it was expecting a text value for the DateTimeValue

 

So I wrapped the selected date in Text()

  • Formula 4: Patch(cpaDB,ThisItem,{'CA-MD-Lic-Exp': DateTimeValue(Text(DatePicker2.SelectedDate,ShortDate))})

No error but it does nothing...

 

This seems like an incredibly simple thing (I just want to pass the date from the datepicker into the CA-MD-Lic-Exp field in my local collection) so I must be missing something incredibly obvious?

 

Note: Out of curiousity, I went to another record where the CA-MD-Lic-Exp field was not blank (it contained one of the dates exported into it from Excel) and I was able to patch it with the datepicker value successfully using Formula 1.

Categories:
  • Brian Dang Profile Picture
    3,976 on at

    Hi @seraph787,

    Can you look at how the table is setup in Excel--is the date column appearing as a date, value, or text?

  • seraph787 Profile Picture
    149 on at

    It's showing as Date regardless of whether I select the entire column or just that record's field.

    Excel CA-MDL-Exp Format.png

  • seraph787 Profile Picture
    149 on at

    Anyone have any ideas?

  • seraph787 Profile Picture
    149 on at

    Is this just a bug?  If it's not verified, maybe someone else can see if they can reproduce the error?

     

    Need to have an Excel spreadsheet in Onedrive (for business?) with a table containing a few different columns, one of which contains dates (in 90% of the records?  Leave the other 10% blank) formatted as a date.

     

    Use it as a data source in a PowerApps. Import that data source to a Collection.  Then create a gallery and use a datepicker to reference that field.  Use a button to patch the field.  

     

    For myself, I can patch changes to the field for records in the collection that already have a date but I can't patch changes to fields that are blank in the collection.

  • MarcinP Profile Picture
    2 on at

    Hi,

     

    I have very similar issue.

     

    Local Collection, created from MS SQL Database:

    ClearCollect(users_col,'[dbo].[LIST]');

    I am not able to patch cell which is NULL in this collection.

     

    For example - Collection has 2 columns: USER_ID and USER_VALUE (integer)

    below code works only for records where USER_VALUE is not null:

    Patch(users_col,First(Filter(users_col,USER_ID=1)),{USER_NAME:1})

    I have the same issue with date column.

    Any idea?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have the exact same issue with a SQL backend powerapp. Create a local collection on load and if the date is null then the collection will not take a patch.

  • Mr-Dang-MSFT Profile Picture
    Microsoft Employee on at

    @Anonymous ,

    It sounds like you are trying to patch a collection where there is a null in the date field. Can you enable Formula Level Error management and try it again?

     

    + @Anonymous 

     

    image.png

     

  • PraktikUser Profile Picture
    4 on at

    We experience exactly identical behaviour. If date column already has datetime filled in, patch owrks. if column in given row is NULL, nothing happens.

  • digiservice Profile Picture
    76 on at

    Also having this same issue.

     

    Patching a datevalue back to a collection which has been collected from a SQL table.

     

    We can patch other values just not datetimevalues, nothing happens.

     

    If I add a new row to the collection it works and will patch dates. Just can't update existing rows.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Still unable to complete this patch. Can't even create a new record in my collection with dates. I have the Formula Level Error management enabled and still no change.

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 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard