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 / autogenerating /number...
Power Apps
Answered

autogenerating /number sequencing in PowerApps

(0) ShareShare
ReportReport
Posted on by 10

I have a collection with column sequence number(hardcoded numbers) and item name. collection gets the data from excel . Now I have a use case where on button click random number(start, end) gets generated ,it selects the sequence number and item name accordingly and it removes that particular record from collection . 

e.g. 

sequence number   item name 

1                               item 1

2                               item 2

3                               item 3

 

if the generated random number is 2 ,it will remove that particular record from collection . 

sequence number   item name 

1                               item 1

3                               item 3

 

Now the issue is if click that button again ,sometimes its generating same random number again .in this case 2 .but now particular record with that number doesn't exists. so how can I sequence that sequence number column in order to avoid this issue

Thanks in advance

 

@RezaDorrani  your suggestion do matter 🙂 

Categories:
I have the same question (0)
  • Pablo Roldan Profile Picture
    316 on at

    Hi, you could place a check condition before remove the element

    here the code, it's a concept but you need adapt it

    If(!IsBlank(Filter('YourCollection',ID = YOURIDGENERATED),Remove('YourCollection',ITEM_TO_REMOVE))

     regards

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

    Hi @PallaviSW :

    I've made a test for your reference:

    1\I assume there is a table 

    ClearCollect(
     TheCollection,
     {'sequence number':1,'item name':"item 1"},
     {'sequence number':2,'item name':"item 2"},
     {'sequence number':3,'item name':"item 3"}
    )

    2\You could use this formula to remove a row randomly.

    With(
     {DeleteRowNumber:RandBetween(1,CountRows(TheCollection))},
     Remove(
     TheCollection,
     Last(FirstN(TheCollection,DeleteRowNumber))
     )
    )

     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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard