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 / Iterate over each Day ...
Power Apps
Unanswered

Iterate over each Day between StartDate and EndDate by using ForAll

(0) ShareShare
ReportReport
Posted on by 95
Hi All,
I have a connector which should be return somedata based on From date to To date.
Ex: 03/11/2020 to 05/11/2020. Like For loop, based on start and end date. Can some help me on this by using ForAll in powerapps.
Like below:
 
for(DateTime date = StartDate; date.Date <= EndDate.Date; date = date.AddDays(1))
{
...
}
Categories:
I have the same question (0)
  • v-siky-msft Profile Picture
    on at

    Hi @BKGOUD ,

     

    The number of iterations of ForAll() function depends on the number of rows in collection, so first use DateDiff() function to get the total number of days, and use sequence() function to generate a sequence collection. Please try this:

    ForAll(
    Sequence(DateDiff(StartDate, EndDate, Days)),
    ...
    )

     

    Hope this helps.

    Sik

  • BKGOUD Profile Picture
    95 on at

    Hi @v-siky-msft ,

     

    Thanks for helping me.

    I'm using the findmeetingstimes connector to loop based on the start date and end date.

    So, i have to run my loop based on date and by startdate and enddate each iteration to the connector.

    Could you please help me on this.

     

    ClearCollect(
    ConflictsRooms,
    Office365.FindMeetingTimes(
    {
    RequiredAttendees: AllRoomsConnector,
    IsOrganizerOptional: true,
    Start: DateTimeValue(StartDateTimeUTC1),
    End: DateTimeValue(EndDateTimeUTC1),
    MeetingDuration: 60,
    MinimumAttendeePercentage: "1",
    ActivityDomain: "Unrestricted"
    }
    )
    );

  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @BKGOUD ,

     

    Sequence() function generates a sequence collection starts from 1, so the start and end parameter is based on the StartDate and sequence value of the current loop.

    Clear(ConflictsRooms);
    ForAll(

    Sequence(DateDiff(StartDate, EndDate, Days)),

    Collect(
    ConflictsRooms,
    Office365.FindMeetingTimes(
    {
    RequiredAttendees: AllRoomsConnector,
    IsOrganizerOptional: true,
    Start: DateAdd(StartDate, Value-1),
    End: DateAdd(StartDate, Value),
    MeetingDuration: 60,
    MinimumAttendeePercentage: "1",
    ActivityDomain: "Unrestricted"
    }
    )
    );

    )

     

    Hope this helps.

    Sik

     

     

     

     

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard