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 / ForAll & Patch changes...
Power Apps
Unanswered

ForAll & Patch changes values of Time after 5 or more records

(0) ShareShare
ReportReport
Posted on by 149

Hi All,

 

I have a Patch & ForAll in a Scheduling application.

My custom form allows to choose multiple dates and it replicates the time, add's it to a collection and I display it on the screen.
Then, when you press save, it Patches through to the SharePoint List.

 

Mo_Islam_0-1600722804157.png

 

Collection per click on calendar item

Patch(
 colAddEvent,
 Defaults(colAddEvent),
 {
 LessonNo: varAddLesson +1,
 LessonDateStart: DateAdd(_firstDayInView,ThisItem.Value,Days),
 LessonDateEnd: DateAdd(_firstDayInView,ThisItem.Value,Days),
 StartHour: ddStartHour_3.Selected.Value,
 StartMinute: ddStartMinutes_3.Selected.Value,
 EndHour: ddEndHour_3.Selected.Value,
 EndMinute: ddEndMinutes_3.Selected.Value
 }
);
UpdateContext({varAddLesson: varAddLesson + 1})

 

Save Button (Patch to SharePoint List)

If(
 lblDoubleBooked_1.Visible = true Or IsBlank(TeacherSelector_1),
 UpdateContext({showErrorBox: true}),
 ForAll(
 galleryClassAdd_1.AllItems,
 Patch(
 DB_Timetable,
 Defaults(DB_Timetable),
 {
 ParticipantsPicker: 
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & PersonSelector_1.Selected.Mail,
 Department: "",
 DisplayName: PersonSelector_1.Selected.DisplayName,
 Email: PersonSelector_1.Selected.Mail,
 JobTitle: "",
 Picture: ""
 },
 Event: event_1.Text,
 Category: CategorySelector_1.Selected,
 Location: txtLocation_1.Text,
 LessonNo: txtLessonNoAdd_1.Text
 EventDate: DatePicker1.SelectedDate + Time(
 Value(ddStartHour_4.Selected.Value),
 Value(ddStartMinutes_4.Selected.Value),
 0
 ),
 EndDate: DatePicker1.SelectedDate + Time(
 Value(ddEndHour_4.Selected.Value),
 Value(ddEndMinutes_4.Selected.Value),
 0
 )}));
Refresh(DB_Timetable)

 

Problem

  • When the data is patched, sometimes the time is changed which displays incorrect data on the schedule for workers.

    Here is an example of what happened, the time should be 08:00 - 10:00
    Mo_Islam_1-1600723646009.png

     


    Sometimes it does it correctly up to 10 records, and then it goes an hour back.

Please can someone shed some light.

 

Thank you

 

 

Categories:
  • PaulD1 Profile Picture
    2,914 on at

    Could you try assigning galleryClassAdd_1 to  a collection and then using the ForAll on the collection?

    ClearCollect(colClassAdd,galleryClassAdd_1.AllItems);
    ForAll(colClassAdd,...

     

  • Mo_Islam Profile Picture
    149 on at

    @PaulD1 Thank you for your prompt response, but unfortunately the same problem occured.

     

    I added 17 rows, it was 08:00 - 10:00 for the first 9 rows and for the last row,

    rows 10-16 was 07:00 - 09:00

     

    This is really a huge problem.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 271

#3
Mohsin Ali Profile Picture

Mohsin Ali 223

Last 30 days Overall leaderboard