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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Data Table with unknow...
Power Apps
Unanswered

Data Table with unknown number of columns - Dynamic collection

(0) ShareShare
ReportReport
Posted on by

Hi,

I've developing an survey app which contains a table where only first column is fixed (it's always the same), but this table could have 1 or 2 or more additional columns, and they depends on amounts of buildings to visit.

In other words, each user of my app can build a table where he/she will choose the amount the buildings to visit (it can be 1 or 100) and then in each visit the user can load the necessary amount of SpecificParts for each visited building.

Each user will create a different Table each time, which will have a different number of columns each time.

 

so, the deliverable table should be looks like:

DeliverableTable= { SpecificParts, Building #1, building #2,.......}

 

I was trying with following simple example

ClearCollection(colFixColTable, { SpecficPart: "KTN2134"} )

also, in a Text Input, the user must write each name of building to visit

and adding a Data Table:

 DataTable1.Items = ClearCollection( colDelivTable, AddColumns(colFixColTable, BuildingNames.Text, 0) )

but it's seems does not work

seems it is not possible to add columns to a collection dynamically.

 

Any idea or help will be appreciated. Thank U!

 

Cheers

FSio

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @FSio Firstly, DataTable1.Items = In PowerApps you cannot assign values like this. You have to set the desired value in the Items property of the control (DataTable1).

    Secondly, the columns names(s) in AddColumns has to be a string (for example, "Name" with double quotes included). It cannot be a variable or refer to a string elsewhere.

    To solve your problem, you shouldn't be adding 1 - 100 columns but rather have a set number of fixed columns like BuildingNo, PartNo etc., and then add 1 - 100 records depending on how many visits the user makes.

  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @FSio ,

    For your first

    ClearCollect(
     colFixColTable, 
     {SpecficPart: "KTN2134"}
    )

    Your data table Items - assuming you want a text field

    AddColumns(
     colFixColTable, 
     "BuildingNames", "0"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @FSio 

    It seems to me that your basic design should consist of two tables in a one to many relationship.  The parent table would be specific part and any description related to it and the second table would be buildings with a reference back to the ID of the part.  You could then number each building in the child table and there would be no limit to the number of rows in that table.    This design is flexible in that you could search for buildings by part and also parts by building.

    _1.jpg

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard