cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JR-BejeweledOne
Super User
Super User

Get the current iteration value of sequence

I am trying to simplify the creation of events that are being used in another Power app.    Some events will span more than one day but need to be created individually for the other app to be able to consume them properly. 

 

Here is my starting point.  It works quite nicely, but I need to increment the date each time.   I was hoping there would be a way to capture the number of the sequence iteration to use as the DateAdd value.   Since the date needs to be incremented by an increasing number of days for each iteration that seems like a logical place to get that number.   I.E., Datepicker value 12/23/2022, 1st iteration: increment by 1 - 12/24/2022, 2nd iteration increment by 2 - 12/25/2022, 3rd iteration increment by 3 - 12/26/2022 and so on.

ForAll(
    Sequence((DateDiff(DatePickerHolidayDate.Value, DatePickerHolidayEndDate.Value) -1)),
            Collect(HolidayCollection, 
            {
            Holiday: ComboBoxHoliday.Selected.Name, 
            DateAdd(HolidayDate: DatePickerHolidayDate.Value, 1) 
                       
              }
            )
)

 

Solutions, ideas or suggestions welcome.

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@JR-BejeweledOne 

 

ForAll(
    Sequence((DateDiff(DatePickerHolidayDate.Value, DatePickerHolidayEndDate.Value) -1)) As ThisSequenceNumber,
    Collect(HolidayCollection, 
        {
        Holiday: ComboBoxHoliday.Selected.Name, 
        HolidayDate: DateAdd(DatePickerHolidayDate.Value, ThisSequenceNumber.Value, Days) 
        }
    )
)

View solution in original post

2 REPLIES 2
Alex_10
Super User
Super User

@JR-BejeweledOne 

 

ForAll(
    Sequence((DateDiff(DatePickerHolidayDate.Value, DatePickerHolidayEndDate.Value) -1)) As ThisSequenceNumber,
    Collect(HolidayCollection, 
        {
        Holiday: ComboBoxHoliday.Selected.Name, 
        HolidayDate: DateAdd(DatePickerHolidayDate.Value, ThisSequenceNumber.Value, Days) 
        }
    )
)

View solution in original post

JR-BejeweledOne
Super User
Super User

EXCELLENT!    That works beautifully, thank you.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,184)