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 and Patch with ...
Power Apps
Unanswered

ForAll and Patch with array as iteration

(0) ShareShare
ReportReport
Posted on by 4

Hello,

 

I have a drop down that is used for the user to set how many weeks they wish to repeat a booking which is then stored as a global variable.

So example @RepeatFor= 4

 

I then need to append this data to the SharePoint list repeating for the number of times in @RepeatFor and append 7 days on each time. 

 

Im getting errors and I'm going round in circles trying to fix it. Could someone please help ?

 

 

Set(repeatCount, RepeatFor);
Set(Increment, 0);
ClearCollect(loopFor, Sequence(repeatCount));

 ForAll(
 loopFor,
 Patch(
 'Desk Reservations',
 Defaults('Desk Reservations'),
 {
 Title: selectedPerson.DisplayName & " " & ThisRecord.Title,
 DeskText: ThisRecord.Title,
 'Check Out From': DateAdd(DateAdd(startTime, Increment, Days), TimeUnit.Minutes ),
 'Check Out From Text': DateAdd(startTime, Increment, Days),
 'Check Out From Number':Value(Text(startTime,"yyyymmddhmm")),
 'Check Out To': DateAdd(DateAdd(endTime, Increment, Days), TimeUnit.Minutes ),
 'Check Out To Text': DateAdd(endTime, Increment, Days),
 'Check Out To Number': Value(Text(DateAdd(endTime, Increment, Days),"yyyymmddhmm")),
 ReservedBy: {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & selectedPerson.Mail,
 Department: "",
 DisplayName: selectedPerson.DisplayName,
 Email: selectedPerson.Mail,
 JobTitle: "",
 Picture: ""
 }
 }
 )
 Set(Increment, Increment + 7)
);

 

 

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

    what is the error you are facing ? 
    can you confirm data you are patching has the expected format and type by the list ? 

  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @nstrain 

     

    please try this:

    Set(repeatCount, RepeatFor);
    Set(Increment, 0);
    ClearCollect(loopFor, Sequence(repeatCount));
    
    ForAll(
     loopFor,
     Patch(
     'Desk Reservations',
     Defaults('Desk Reservations'),
     {
     Title: selectedPerson.DisplayName & " " & Text(DateAdd(startTime, Increment, Days),"[$-en-US]dddd"),
     DeskText: ThisRecord.Title,
     'Check Out From': DateAdd(startTime, Increment, Days),
     'Check Out From Text': Text(DateAdd(startTime, Increment, Days), "[$-en-US]dddd, mmmm dd, yyyy"),
     'Check Out From Number': Value(Text(DateAdd(startTime, Increment, Days),"yyyymmdd")),
     'Check Out To': DateAdd(endTime, Increment, Days),
     'Check Out To Text': Text(DateAdd(endTime, Increment, Days), "[$-en-US]dddd, mmmm dd, yyyy"),
     'Check Out To Number': Value(Text(DateAdd(endTime, Increment, Days),"yyyymmdd")),
     ReservedBy: {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     Claims: "i:0#.f|membership|" & selectedPerson.Mail,
     Department: "",
     DisplayName: selectedPerson.DisplayName,
     Email: selectedPerson.Mail,
     JobTitle: "",
     Picture: ""
     }
     }
     );
     Set(Increment, Increment + 7)
    );

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard