web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : i5xhG/rVhJT9S69xkHAFM3
Power Automate - Building Flows
Answered

Indexing 'Get items' in HTML table

Like (0) ShareShare
ReportReport
Posted on 7 Mar 2022 09:30:14 by 101

Hi PA community,

 

I am working on simple flow that will be triggered manually. Scheme will be as follows:

1. Manual Trigger -> 2. Get Items from a sharepoint list by filtering entire list by input from step 1 -> 3. create HTML table from previous 'Get Items' --> 4. send HTML table by email 

 

Re step 3: For each run, the number of items will be different -> the number of rows in the HTML table will be different.

 

My question:
Is there a way to newly index all items for each run in a separate column (as part of the new HTML table), so that it looks like:

 

HTML table:
New Index / Column A from sharepoint list / Column B from sharepoint list

1 / value1 A / value1 B
2 / value2 A / value2 B

n / valuen A / valuen B

 

Many thanks

  • sebkath14 Profile Picture
    101 on 30 May 2022 at 19:04:13
    Re: Indexing 'Get items' in HTML table

    @abm This does the trick! Thanks for your help, appreciated. 

  • Verified answer
    abm abm Profile Picture
    32,506 Most Valuable Professional on 30 May 2022 at 14:36:24
    Re: Indexing 'Get items' in HTML table

    Hi @sebkath14 

     

    Please ignore my earlier suggestion. This will work.

     

    image.png

     

    Range expression

     

    range(0, length(outputs('Compose')))

     

    For the serial number No

     

    if(equals(item(), 0), 1, add(item(),1))

     

    Thanks

  • sebkath14 Profile Picture
    101 on 30 May 2022 at 13:37:30
    Re: Indexing 'Get items' in HTML table

    Hi @abm 

     

    I get the following error message when using your expression:

    sebkath14_0-1653917776119.png


    This is where I used it:

    sebkath14_1-1653917826227.png

     

  • sebkath14 Profile Picture
    101 on 30 May 2022 at 13:37:25
    Re: Indexing 'Get items' in HTML table

    Hi @abm 

     

    I get the following error message when using your expression:

    sebkath14_0-1653917776119.png


    This is where I used it:

    sebkath14_1-1653917826227.png

     

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 30 May 2022 at 13:26:36
    Re: Indexing 'Get items' in HTML table

    Hi @sebkath14 

     

    Try the below expression

     

    add(int(range(1, length(outputs(‘Compose’)))), 1)

  • sebkath14 Profile Picture
    101 on 30 May 2022 at 11:48:07
    Re: Indexing 'Get items' in HTML table

    @abm Thanks again for your hint. Just wanted to follow up on the progress I made. Based on your hint, I also found this resource (https://crmtipoftheday.com/1434/can-you-count-or-how-to-add-index-to-array-in-power-automate/) and I managed to create the new index column, as follows:

     

    image.png

    I used all the expressions that are mentioned in the linked resource above. My input source is a 'Filter Array' that filtered my 'Get Items'. While the index column (red rectangle) is starting at 1 (likely due to the expression --- range(1, length(outputs(‘INPUT ACTION'))) ---) the other data (Date and Weekdays) is starting with the second "row" of the respective column. For Date it should start with 2nd May (not 3rd May) and Weekday should start with "Montag" and not "Dienstag". All missing data is included in the output of the previous 'Filter Array' action. I assume that the array is displayed zero-based and there is also a hint mentioned in the linked resource, but I do not know how or where to apply it. 

     

    sebkath14_0-1653911154412.png

    When I change the green marked 1 to 0 in the range expression, I get all my data from the previous Filter Array but the index has to start with 1 as it is indexing the number of workdays (and therefore, cannot be 0).

     

    Do you have an idea how the other data could be "moved" by one row to let it start with index 1?

     

    Many thanks!

     

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 07 Mar 2022 at 13:05:53
    Re: Indexing 'Get items' in HTML table

    Hi @sebkath14 

     

    Thanks for your quick reply. In your custom array you need to maintain a custom column for the index. Yes eventually that will be in the new html table.

     

    Thanks

  • sebkath14 Profile Picture
    101 on 07 Mar 2022 at 12:45:07
    Re: Indexing 'Get items' in HTML table

    @abm Thanks for your message. And by creating my own array from filter results I "create" the information for the new index column (that will eventually be DISPLAYED in the new html table)? Thx

  • abm abm Profile Picture
    32,506 Most Valuable Professional on 07 Mar 2022 at 12:32:25
    Re: Indexing 'Get items' in HTML table

    Hi @sebkath14 

     

    For this you need to create your own custom array which  should keep all the filter results.  Once you had all the results then you can use the create html to create the HTML table.

     

    Thanks

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete