cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
morall
Microsoft
Microsoft

Incrementing a variable in a ForAll()

This is some code that is creating a collection

 

Set(
    Counter,
    0
);
ClearCollect(
    statusTable,
    'OneEng Candidates'.GeneralStatus
);
Collect(
    sortedTable,
    ""
);
Clear(sortedTable);
ForAll(
    statusTable,
    Collect(
        sortedTable,
        {
            status: ThisRecord.GeneralStatus,
            number: Counter+1
        }
    )
)

 

 

The collection looks like:

 

Screen Shot 2020-07-28 at 10.48.49 AM.png

However I want the counter to go up by 1 every time. Is there a way to increment the counter within the ForAll Loop in the above context? 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JR-BejeweledOne
Super User
Super User

I don't have the answer for you, but I just ran into this video this morning and it seems it probably covers exactly what you are wanting to do.

 

https://youtu.be/oKJkVx2gehw



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.

View solution in original post

1 REPLY 1
JR-BejeweledOne
Super User
Super User

I don't have the answer for you, but I just ran into this video this morning and it seems it probably covers exactly what you are wanting to do.

 

https://youtu.be/oKJkVx2gehw



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.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,895)