cancel
Showing results for
Did you mean:
Responsive Resident

## Loops with multiple collections...

I have a collection of dates...(one row per date) - say 31 days of Jan 2023.

1/1/2023, 1/2/2023, 1/3/2023, etc...
For Each Date I want to add a sequence.. at 15 min increments for each day (in the end from 7:00 AM to 7:00 PM)

``````ForAll(
Sequence(
49,/* how many times to repeat */
420,/* starting time for day in minutes */
15/* repeat every 15 mins */
)
)``````

1/1/2023 7:00 AM, 1/1/2023 7:15 AM, 1/1/2023 7:30 AM, .... 1/2/2023 7:00 AM, 1/2/2023 7:15 AM, 1/2/2023 7:30 AM
For some reason I am struggling with the concept of ForAll here and creating a table that is 31 (days) x 49 (sequences) = 1,519 rows from 2 separate collections.

I'm sorry but I think I've confused myself. Can someone help me get on the right path please. I am more accustomed to 1:1 lookups.

1 ACCEPTED SOLUTION

Accepted Solutions
Multi Super User

Here is the collection of days (of course you can as some dynamic logic to fill the days):

``````ClearCollect(
MyDays,
ForAll(
Sequence(31),
DateValue("12/31/2022"),
Value,
TimeUnit.Days
)
)
);``````

And here is the logic to fill with data (15 min gap from 7:00 AM to 7:00 PM) a new collection starting from the previous collection:

``````ClearCollect(
MyTimeInterval,
Ungroup(
ForAll(
MyDays As _myDaysItem,
{
ByDays: ForAll(
Sequence(49),
{
_myDaysItem.Value,
405 + Value * 15,
TimeUnit.Minutes
)
}
)
}
),
"ByDays"
)
)``````

Hope it helps !

2 REPLIES 2
Multi Super User

Here is the collection of days (of course you can as some dynamic logic to fill the days):

``````ClearCollect(
MyDays,
ForAll(
Sequence(31),
DateValue("12/31/2022"),
Value,
TimeUnit.Days
)
)
);``````

And here is the logic to fill with data (15 min gap from 7:00 AM to 7:00 PM) a new collection starting from the previous collection:

``````ClearCollect(
MyTimeInterval,
Ungroup(
ForAll(
MyDays As _myDaysItem,
{
ByDays: ForAll(
Sequence(49),
{
_myDaysItem.Value,
405 + Value * 15,
TimeUnit.Minutes
)
}
)
}
),
"ByDays"
)
)``````

Hope it helps !

Responsive Resident

Thanks @gabibalaban  I'll let you know how this works out shortly... I think it's the ungroup thing that I was missing.

Announcements

#### A Celebration of What We've Achieved--And Announcing Our Winners

As the sun sets on the #SummerofSolutions Challenge, it's time to reflect and celebrate! The journey we embarked upon together was not just about providing answers – it was about fostering a sense of community, encouraging collaboration, and unlocking the true potential of the Power Platform tools.   From the initial announcement to the final week's push, the Summer of Solutions Challenge has been a whirlwind of engagement and growth. It was a call to action for every member of our Power Platform community, urging them to contribute their expertise, engage in discussions, and elevate collective knowledge across the community as part of the low-code revolution.   Reflecting on the Impact As the challenge ends, it's essential to reflect on the impact it’s had across our Power Platform communities: Community Resilience: The challenge demonstrated the resilience of our community. Despite geographical distances and diverse backgrounds, we came together to contribute, learn, and collaborate. This resilience is the cornerstone of our collective strength.Diverse Expertise: The solutions shared during the challenge underscore the incredible expertise within our community. From intricate technical insights to creative problem-solving, our members showcased their diverse skill sets, enhancing our community's depth.Shared Learning: Solutions spurred shared learning. They provided opportunities for members to grasp new concepts, expand their horizons, and uncover the Power Platform tools' untapped potential. This learning ripple effect will continue to shape our growth. Empowerment: Solutions empowered community members. They validated their knowledge, boosted their confidence, and highlighted their contributions. Each solution shared was a step towards personal and communal empowerment. We are proud and thankful as we conclude the Summer of Solutions Challenge. The challenge showed the potential of teamwork, the benefit of knowledge-sharing, and the resilience of our Power Platform community. The solutions offered by each member are more than just answers; they are the expression of our shared commitment to innovation, growth, and progress!   Drum roll, Please... And now, without further ado, it's time to announce the winners who have risen above the rest in the Summer of Solutions Challenge!   These are the top community users and Super Users who have not only earned recognition but have become beacons of inspiration for us all.   Power Apps Community:  Community User Winner: @SpongYe Super User Winner: Pending Acceptance Power Automate Community:  Community User Winner: @trice602 Super User Winner: @Expiscornovus  Power Virtual Agents Community: Community User Winner: Pending AcceptanceSuper User: Pending Acceptance Power Pages Community: Community User Winner: @OOlashyn Super User Winner: @ChristianAbata   We are also pleased to announced two additional tickets that we are awarding to the Overall Top Solution providers in the following communities:    Power Apps: @LaurensM   Power Automate: @ManishSolanki    Thank you for making this challenge a resounding success. Your participation has reaffirmed the strength of our community and the boundless potential that lies within each of us. Let's keep the spirit of collaboration alive as we continue on this incredible journey in Power Platform together.Winners, we will see you in Vegas! Every other amazing solutions superstar, we will see you in the Community!Congratulations, everyone!