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 / Patching Collection fo...
Power Apps
Answered

Patching Collection for each Gallery Record

(0) ShareShare
ReportReport
Posted on by 11

I have two data verse tables:

  • Table 1 collects the employee number, job number, date worked and hours worked
  • Table 2 collect the employee number, job number, date worked, work start time, work stop time, clock in method, clock out method and then an hours field which is calculated based on the work start time and work stop time. 

I have a screen that allows for the user to submit the job number, date worked and hours worked for the week in a gallery which populates a collection and then ultimately patches table 1. I've created the second collection for Table 2 with the overlapping data from the collection for table 1 (employee number, job number, date worked), but am stuck on trying to patch the work start time with the date worked and a default start time of 7:00 am. 

 

This is my current formula and although it's not throwing any errors, it doesn't look like its able to process that for each record I need to match the date worked to update the work start time:

 

ForAll(WeekTimeSubmissionGallery.AllItems, UpdateIf(Table2Collection,ThisRecord.DateWorked=DateWorked, {WorkStartTime: DateTimeValue(Text(ThisRecord.DateWorked) && "7:00 AM")}));

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,525 Most Valuable Professional on at

    Hi @Rachel19 ,

    Try this format

    ForAll(
     WeekTimeSubmissionGallery.AllItems, 
     UpdateIf(
     Table2Collection,
     ThisRecord.DateWorked = DateWorked, 
     {
     WorkStartTime: 
     ThisRecord.DateWorked + Time(7,0,0)
     }
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Rachel19 Profile Picture
    11 on at

    Thanks @WarrenBelz  that worked perfectly. Is there a way to get work stop time from the start time + hours? 

     

    This is what I have, but it's not working because I'd not referencing the hours worked from Collection1.

     

    ForAll(WeekTimeSubmissionGallery.AllItems, UpdateIf(Table2Collection, ThisRecord.DateWorked = DateWorked,{WorkStartTime: ThisRecord.DateWorked + Time(7,0,0), WorkStopTime: DateAdd((ThisRecord.DateWorked + Time(7,0,0)), LookUp(colPayrollTimecard, DateWorked=ThisRecord.DateWorked, Hours),TimeUnit.Hours)}));

  • WarrenBelz Profile Picture
    155,525 Most Valuable Professional on at

    Hi @Rachel19 ,

    By Collection1, do you mean colPayrollTimecard ? If so, I cannot see a lot wrong with your code, but try this

    ForAll(
     WeekTimeSubmissionGallery.AllItems,
     With(
     {
     _Start: ThisRecord.DateWorked + Time(7,0,0),
     _Hours: 
     LookUp(
     colPayrollTimecard, 
     DateWorked = ThisRecord.DateWorked
     ).Hours
     },
     UpdateIf(
     Table2Collection, 
     ThisRecord.DateWorked = DateWorked,
     {
     WorkStartTime: _Start,
     WorkStopTime: 
     DateAdd(
     _Start,
     _Hours,
     TimeUnit.Hours
     )
     }
     )
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 408

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 319

Last 30 days Overall leaderboard