cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
dzemiol
Level: Powered On

Numbering rows in the table

Hi,

 I have a collection with data. I need to create an HTML table with a row per record in the collection.  I use the Concat function and it works perfect. But I need to add an HTML table column with "Item number" in it, that goes from 1 to the number of the records in the collection.  E.g.
Lp FirstName LastName
1   John          Smith

2   Jake           Black

3   Susan         White

etc.
 I thought I'll copy data from the original collection into a new one with one additional value for index, but it's imposible to have a variable that gets incremented within ForAll function (UpdateContext and Set functionas are not allowed inside ForAll).
 Is there any way I can achive this? Any way to go thru a collection items and have and incrementing index

1 ACCEPTED SOLUTION

Accepted Solutions
dzemiol
Level: Powered On

Re: Numbering rows in the table

I was able to solve it myself. 
Assuming Original collection has two columns named FirstName and LastName.

New collection with three columns IndexCol, FirstNameCol and LastNameCol.
ForAll(
   OriginalCollection,
   Collect(
      NewCollection,
      {IndexCol: CountRows(NewCollection)+1, FirstNameCol: FirstName, LastNameCol: LastName }
   )
)

This does the trick Smiley Happy

1 REPLY 1
dzemiol
Level: Powered On

Re: Numbering rows in the table

I was able to solve it myself. 
Assuming Original collection has two columns named FirstName and LastName.

New collection with three columns IndexCol, FirstNameCol and LastNameCol.
ForAll(
   OriginalCollection,
   Collect(
      NewCollection,
      {IndexCol: CountRows(NewCollection)+1, FirstNameCol: FirstName, LastNameCol: LastName }
   )
)

This does the trick Smiley Happy

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 255 members 3,990 guests
Please welcome our newest community members: