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 Apps
Answered

Powerapp Table

(0) ShareShare
ReportReport
Posted on by 23

Hello! So I am creating a test management app, and one of the features required of my app is that it must display a table of user inputed information. Is there a way to generate the size of the table based on user input? For example, I ask the user how many steps they need and if they enter "20", a table with 20 rows will generate. Thank you! 

Categories:
  • GarethPrisk Profile Picture
    2,828 on at

    Yes, this possible.

    The Sequence function, coupled with ForAll is a great way to accomplish this. The Sequence function will allow you to generate a table of rows for X number, up to 50k. You can have this be a user input, to let them set a value.

     

    Then you can write a function like this:

     

    With( { rowsToCreate: Sequence ( Value ( TextInput.Value ) ) } , ForAll ( rowsToCreate, Collect ( colTable , { column1: "Value1", column2: "Value2" } ) ) )

  • mdevaney Profile Picture
    29,993 Moderator on at

    @GarethPrisk 

    I love the SEQUENCE function and your idea:

    With( { rowsToCreate: Sequence ( Value ( TextInput.Value ) ) } , ForAll ( rowsToCreate, Collect ( colTable , { column1: "Value1", column2: "Value2" } ) ) )

     

    I wanted to share a slightly more concise way of writing it without the WITH function.

    ClearCollect(colTable, ForAll(Sequence(Value(TextInput.Value)), { column1: "Value1", column2: "Value2" }))

     

    Any credit for the solution should go to you.  Just wanted to share my finding because I’m totally nerding out over SEQUENCE!

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • GarethPrisk Profile Picture
    2,828 on at

    That's a really interesting pattern!

    I have always put collects inside my ForAlls, but never thought to collect the ForAll itself.

    It would be interesting to test this with the monitor to see how it handles the API calls and the performance of each approach.

    Cheers!

  • haqian Profile Picture
    23 on at

    @mdevaney  @GarethPrisk 

    I'm sorry, I'm new to powerapps and am still trying to figure out all the functions. I created a new empty gallery and tried putting your code into "items", but I keep getting errors in the code and can't seem to fix it. Any ideas? 

  • Verified answer
    GarethPrisk Profile Picture
    2,828 on at

    No worries!

    The first thing to figure out is when should the Collection be created. It sounded like you wanted some sort of User input to dictate how many rows the table should include. Therefore, we can use a TextInput control to capture the number of rows and then create a collection to show those rows.

     

    1. Add a TextInput control (for this example, it'll be called TextInput1)
    2. If you want the table to generate after the set the TextInput1 value
      • Set the Format property of TextInput1 to TextFormat.Number
      • Set the DelayOuput property of TextInput1 to true
      • Set the OnChange property of TextInput1 to include this function

     

    With(
     {rowsToCreate: Sequence (Value (Self.Text))},
     ForAll (
     rowsToCreate,
     Collect (
     colTable,
     {
     column1: "Value1",
     column2: "Value2"
     }
     )
     )
    ) 

     

    1. Add a Gallery control (or Data Table)
      • Set the Item property to colTable
    2. Map column1 and column2 to controls/columns, to show their values
    3. Enter value(s) into TextInput1 and see the Gallery/Data Table update as needed

     

    This should hopefully address the concepts. Then you can expand upon them to only create the collection once, or with a different mechanism for determining the number of rows. Then you can also add more columns to the table/collection, and find ways to set those as something other than just plain text. Enjoy!

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard