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 / Collections create Id
Power Apps
Answered

Collections create Id

(0) ShareShare
ReportReport
Posted on by 494

Hi Guys,
can we possibly create an Autoincrement ID using Collection as a database?

Thank you

Categories:
  • Verified answer
    eka24 Profile Picture
    20,925 on at

    If you meant creating an autoincrement ID in a collection, that is possible. However can you give more details on how you create the Collection itself?

    ------------

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

  • Big_S Profile Picture
    494 on at

    Hi @eka24 

    This how I create the collection on App OnStart Property, my idea is every time I click the save button the information will save in my MasterCollection with autoincrement Id
    Concurrent(
    ClearCollect(CollectionA,Filter('[dbo].[Request]',Id < 2000)),
    ClearCollect(CollectionB,Filter('[dbo].[Request]',Id >=2000 And Id<4000)),
    ClearCollect(CollectionC,Filter('[dbo].[Request]',Id >=4000 And Id<6000)),
    ClearCollect(CollectionD,Filter('[dbo].[Request]',Id >=6000 And Id<8000)),
    ClearCollect(CollectionE,Filter('[dbo].[Request]',Id >=8000 And Id<10000)),
    ClearCollect(CollectionF,Filter('[dbo].[Request]',Id >=10000 And Id<12000)),
    ClearCollect(CollectionG,Filter('[dbo].[Request]',Id >=12000 And Id<14000)),
    ClearCollect(CollectionH,Filter('[dbo].[Request]',Id >=14000 And Id<16000)));
    ClearCollect(MasterCollection,CollectionA,CollectionB,CollectionC,CollectionD,CollectionE,CollectionF,CollectionG,CollectionH);

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

    Hi @Big_S :

    In theory, your needs should be achievable.But you need to use the forall function to operate on the records in the MasterCollection one by one.For example:

    1\My table

    ClearCollect(TheTable,{Column1:"A"},{Column1:"B"},{Column1:"C"},{Column1:"D"},{Column1:"E"},{Column1:"F"},{Column1:"G"})

    2\Add a button and set it's OnSelect property to

    Collect(TheTable,{No:999});
    RemoveIf(TheTable,No=999);
    ForAll(Sequence(CountRows(TheTable)),Patch(TheTable,Last(FirstN(TheTable,Value)),{No:Value}))

    101.gif


    However, according to the information you provide, the number of records to be processed may reach more than 10,000. This will seriously affect the performance of the app and may eventually cause the program to crash.

    I suggest you to create an AUTO INCREMENT Field directly in [dbo].[Request].

    ALTER TABLE dbo.Request
    ADD TheID INT Identity(1,1) NOT NULL

    I think this link will help you a lot:

    SQL AUTO INCREMENT Field 

     Best Regards,

     Bof

  • Big_S Profile Picture
    494 on at

    Thank you!!! 🙂

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 226 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 191 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 167

Last 30 days Overall leaderboard