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 / Patching collection to...
Power Apps
Answered

Patching collection to Sharepoint list. Last entry overwrites the others

(0) ShareShare
ReportReport
Posted on by 260

Hello

 

I'd like it if someone would look at my code.

I have a gallery showing colTimesheetLines. It is a dropdown and some text boxes for time entry.

I have a save icon with this in the onSelect

 

ForAll(
 colTimesheetLines,
 Patch(
 EstimatingTime,
 Defaults(EstimatingTime),
 {
 Week: Text(DateLabel),
 Project: ProjectDropdown.Selected.Title,
 MonHour: Value(inputMon.Text),
 TueHour: Value(inputTue.Text),
 WedHour: Value(inputWed.Text),
 ThurHour: Value(inputThur.Text),
 FriHour: Value(inputFri.Text),
 SatHour: Value(inputSat.Text),
 SunHour: Value(inputSun.Text),
 TotalHours: Value(inputTotal.Text),
 Percent: Value(inputTotalPercentage.Text),
 WeekStart: varDate,
 Collated: 0
 }
 )
);
Clear(colTimesheetLines);

 

If I run it with just one entry it is perfect. If I have more than one, three for example, the last record is saved three times, overwriting the earlier ones

ConnM_0-1687359133464.png

 

Thank you for your time

Conn

 

Additionally I would like the ability to edit these, which causes odd problems, but that is totally an extra problem

ConnM_1-1687359329515.png

 

 

Categories:
I have the same question (0)
  • Verified answer
    ConnM Profile Picture
    260 on at

    Patching in the gallery Items instead of the collection sorted it out

    ForAll(
     GalleryMain.AllItems,
     Patch(
     EstimatingTime,
     Defaults(EstimatingTime),
     {
     Week: Text(DateLabel),
     Project: ProjectDropdown.Selected.Title,
     MonHour: Value(inputMon.Text),
     TueHour: Value(inputTue.Text),
     WedHour: Value(inputWed.Text),
     ThurHour: Value(inputThur.Text),
     FriHour: Value(inputFri.Text),
     SatHour: Value(inputSat.Text),
     SunHour: Value(inputSun.Text),
     TotalHours: Value(inputTotal.Text),
     Percent: Value(inputTotalPercentage.Text),
     WeekStart: varDate,
     Collated: 0
     }
     )
    );
    Clear(colTimesheetLines);
  • ConnM Profile Picture
    260 on at

    This  project took inspiration from Matthew's guide, which was a bit beyond my skill level.
    Make A Power Apps Timesheet App - Part 2 (matthewdevaney.com)

    After gaining a bit of knowledge, and adaption to my needs, this is working to allow updating

    ClearCollect(
     colUpdateLines,
     ForAll(
     GalleryMain.AllItems,
     {
     Week: Text(DateLabel),
     Project: ProjectDropdown.Selected.Title,
     MonHour: Value(inputMon.Text),
     TueHour: Value(inputTue.Text),
     WedHour: Value(inputWed.Text),
     ThurHour: Value(inputThur.Text),
     FriHour: Value(inputFri.Text),
     SatHour: Value(inputSat.Text),
     SunHour: Value(inputSun.Text),
     TotalHours: Value(inputTotal.Text),
     Percent: Value(inputTotalPercentage.Text),
     WeekStart: varDate,
     Collated: 0
     }
     )
    );
    
    ClearCollect(
     colTimesheetLines,
     Patch(
     EstimatingTime,
     GalleryMain.AllItems,
     colUpdateLines
     )
    );

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 372 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 303 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 238 Super User 2026 Season 1

Last 30 days Overall leaderboard