cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lalit_Kadam
Helper III
Helper III

Add sequence number column in Collection in power app

Hi,

 

I want to add sequence number column in collection. I am using Sequence function but it is creating all sequence  number in each row.

I want out put like below.

Collection :-

Brand name, Brand description, Brand value

Br1,   Description, 1200

 

I need extra column 

Sequence number , Brand name, Brand description, Brand value

1,    Br1,   Description, 1200

2,    Br2,   Description, 1400

3,    Br3,   Description, 1500

 

Please suggest.

 

Regards,

Lalit Kadam

1 REPLY 1
Adrian_Celis
Super User
Super User

Hi @Lalit_Kadam 

 

Let's say your original data is a collection named OriginalCollection. Try this:

 

//Clear the collection first
Clear(CollectionWithSequenceNumbers);
//For each item in the original collection, add a sequence number
ForAll(OriginalCollection,
    Collect(CollectionWithSequenceNumbers,
        Last(FirstN(AddColumns(OriginalCollection,"Sequence Number",CountRows(CollectionWithSequenceNumbers)+1),CountRows(CollectionWithSequenceNumbers)+1)))
);

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (4,028)