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 / Increment variable in ...
Power Apps
Answered

Increment variable in ForAll

(0) ShareShare
ReportReport
Posted on by 19

Hello community
I have a Collection with the following nomenclature


Set(NumberToUse,1)
ClearCollect(
CurrentCustomersClientsCollection,
{
      IDNumber:NumberToUse,
       Name: ""
}
);

I have to increment the NumberToUse variable every time a record is created in the collection. How can I do?

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,718 Most Valuable Professional on at

    Hi @Iep90,

     

    How much records will be in your CurrentCustomersClientCollection. If it will be under 50000 items you can probably implement a sequence function:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sequence

     

    Shane Young also has a nice video about using the sequence function in different approaches (also a couple examples with ForAll):

    https://www.youtube.com/watch?v=oKJkVx2gehw

     

    Hope this helps a bit?

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Iep90 :

    You could try:

     

    Collect(
    CurrentCustomersClientsCollection,
    {
          IDNumber:Max(CurrentCustomersClientsCollection,IDNumber)+1,
           Name: ""
    }
    );

     

    Best Regards,

    Bof

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 85

#2
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard