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 / Add nth column in Coll...
Power Apps
Answered

Add nth column in Collection data

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

 

I want to add a column in collection.

currently , I'm using the collect function to add new column
-----------------------------------------------------------------

example:

Collect(
    Customgallery,
    {
        item: CountRows(Customgallery),
        detail: Char(RandBetween(67,94))
    }
)
-------------------------------------------------------------------
but now, I'd like to add an nth column with a single click.
I don't have idea to do it. Can anyone provide some suggestions?

 

CookieNamtarn_0-1706261571158.png

Thank you in advance.

Categories:
I have the same question (0)
  • AR-29081311-0 Profile Picture
    137 on at

    Hi @CookieNamtarn ,

    are you looking to add the number of rows in the dropdown (3) when "Ad nth" is selected?.

    If so, try this out onSelect of your nth button: 

     

    // Assuming Dropdown1 is your dropdown control
    ForAll(
    Sequence(Dropdown1.Selected.Value),
    Collect(
    Customgallery,
    {
    item: CountRows(Customgallery),
    detail: Char(RandBetween(67,94))
    }
    )
    )

     

     

    The Sequence function will repeat the collection function, by the number of times in the dropdown.

     

    Hope this helps! 

     

    Aaron

  • Verified answer
    mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @CookieNamtarn 

     

    you can also try this example:

     

    ForAll(
     Customgallery,
     Collect(
     Customgallery,
     {
     item: item, // Existing column
     detail: detail, // Existing column
     newColumn: "New Value" // New column with static value
     }
     )
    )

     

     

    This formula will iterate over each row in the Customgallery collection and add a new column named newColumn with a static value "New Value".

     

    If you need to calculate the value for the new column based on existing data in each row, you would modify the formula accordingly. For example:

     

    ForAll(
     Customgallery,
     Collect(
     Customgallery,
     {
     item: item,
     detail: detail,
     newColumn: item + Len(detail) // Example of a calculated value
     }
     )
    )

     

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 883

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 477

Last 30 days Overall leaderboard