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 / Help! Power Apps Patch...
Power Apps
Suggested Answer

Help! Power Apps Patch function giving error on first two lines — need advice

(0) ShareShare
ReportReport
Posted on by

Hey folks,

I’m trying to use this Patch function in Power Apps to create new time entry records in a TimeEntries data source, but I keep getting errors on the first two lines (Patch(TimeEntries, Defaults(TimeEntries), {...})).

  Patch(
  TimeEntries,
  Defaults(TimeEntries),
  {
   'Project Selected': ProjectDropdown.Selected.Value,

    MonInput: Value(Coalesce(MonInput.Text, "0")),
    TueInput: Value(Coalesce(TueInput.Text, "0")),
    WedInput: Value(Coalesce(WedInput.Text, "0")),
    ThurInput: Value(Coalesce(ThurInput.Text, "0")),
    FriInput: Value(Coalesce(FriInput.Text, "0")),
    SatInput: Value(Coalesce(SatInput.Text, "0")),
    SunInput: Value(Coalesce(SunInput.Text, "0")),

    'Total Hours': Sum(
    [
     Value(Coalesce(MonInput.Text, "0")),
     Value(Coalesce(TueInput.Text, "0")),
     Value(Coalesce(WedInput.Text, "0")),
     Value(Coalesce(ThurInput.Text, "0")),
     Value(Coalesce(FriInput.Text, "0")),
     Value(Coalesce(SatInput.Text, "0")),
     Value(Coalesce(SunInput.Text, "0"))
   ]
   ),

   Stage: StageDropdown.Selected.Value,
   Comments: CommentsInput.Text
  }
)
 

The error specifically points at these two line.

 Patch(
 TimeEntries,
 Defaults(TimeEntries),
 

I’m pretty sure my data source is correctly connected, and I’ve checked the control names (ProjectDropdown, MonInput, etc.) multiple times.

Has anyone seen this kind of error before? What could be causing it?

Any help or pointers would be super appreciated! Thanks!

Screenshot 2025-08-08 134016.png
I have the same question (1)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    Super User 2025 Season 2 on at
     
    Are you trying to Sum multiple values for just that Week itself (based on individual columns) Sum all Mondays and All Tuesuday etc?
     
    Either way remove the [ ] brackets please.
     
    ClearCollect(TimeEntries,
     { MonInput: 1, TueInput: 2, WedInput: 3, ThurInput: 4, FriInput: 5, SatInput: 1, SunInput: 1, 'Total Hours': 7 }
    );
    
    
      Patch(
      TimeEntries,
      Defaults(TimeEntries),
      {
        MonInput: 1,
        TueInput: 2,
        WedInput: 3,
        ThurInput: 4,
        FriInput: 5,
        SatInput: 6,
        SunInput: 7,
    
        'Total Hours': Sum(
    		
    		 First(TimeEntries).MonInput,
    		 First(TimeEntries).TueInput,
    		 First(TimeEntries).WedInput,
    		 First(TimeEntries).ThurInput,
    		 First(TimeEntries).FriInput,
    		 First(TimeEntries).SatInput,
    		 First(TimeEntries).SunInput
       )
      }
    )
    however, if you are trying to ADD together the current Rows items thats an Add thing not necessarily a Sum thing. It can depend.
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • #Jahanvi Arora Profile Picture
    on at

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

Last 30 days Overall leaderboard