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 / Blank date to SQL patc...
Power Apps
Answered

Blank date to SQL patch "Server Response: A value must be provided for item"

(0) ShareShare
ReportReport
Posted on by 76

I have a Patch which is creating a new row in a SQL table using a ForAll and a collection. 

I have a date column that needs on occasion to be blank.

ForAll(
 mycollection,
 Patch(
 mysqltable,
 Defaults(mysqltable),
 {
 mydatecolumn: DateTimeValue(Text(mycollectiondatecolumn))
 }
 )
)

 

 

The SQL column/table is set to accept Null values, however when I patch a null value I get this error:

"Server Response: A value must be provided for item"

 

If I patch a date value it works fine, it only errors when the mycollectiondatecolumn is blank.

 

Is this related to the known issue with blank and nulls? Or am I missing something?

Categories:
I have the same question (0)
  • PavanKumar Profile Picture
    479 on at

    Hi,

     

    Once can you try something like this?

     

    ForAll(
     mycollection,
     Patch(
     mysqltable,
     Defaults(mysqltable),
     {
     mydatecolumn: If(IsBlank(mycollectiondatecolumn),Blank(), DateTimeValue(Text(mycollectiondatecolumn)))
     }
     )
    )

     

     

    If this answers your question mark it as verified and give thumbs up.

    Regards,

    Pavan Kumar Garlapati

  • digiservice Profile Picture
    76 on at

    Hi @PavanKumar ,

     

    I've tried that and get exactly the same response unfortunately 😞

  • PavanKumar Profile Picture
    479 on at
    Hi, I think this helps you. http://powerappsexamples.com/patch-null-value/ If this answers your question mark it as verified and give thumbs up. Regards, Pavan Kumar Garlapati
  • digiservice Profile Picture
    76 on at

    Hi @PavanKumar 

    Thanks again for the suggestion and your help. It's odd because I have found this does not work:

    ForAll(
     mycollection,
     Patch(
     mysqltable,
     Defaults(mysqltable),
     {
     mydatecolumn: If(IsBlank(mycollectiondatecolumn),Blank(), DateTimeValue(Text(mycollectiondatecolumn)))
     }
     )
    )

    Where as this does work:

    ForAll(
     mycollection,
     Patch(
     mysqltable,
     Defaults(mysqltable),
     {
     mydatecolumn: Blank()
     }
     )
    )

    I don't know why it would see either output any differently when essentially they both output blank.

    For my needs the second option isn't viable as I need to be able to populate if if the date field does have a value.

    If I was only updating one column I could wrap it in a conditional as suggested within the blog post you recommended but unfortunately I am patching up to 12 date fields across 166 columns in more than one patch so writing conditions for each potential scenario would be exceptionally messy.

     

    I'll keep tinkering to see if I can come up with a solution.

  • Verified answer
    digiservice Profile Picture
    76 on at

    OK I think I have an answer but will keep testing.

    I found to get the date to patch if there is a value or to be blank if there isn't one, the following appears to work:

    ForAll(
     mycollection,
     Patch(
     mysqltable,
     Defaults(mysqltable),
     {
     mydatecolumn: Coalesce(Blank(), mycollectiondatecolumn)
     }
     )
    )

     

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard