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 / Bind datatable to mult...
Power Apps
Unanswered

Bind datatable to multiple datasource from CDS - Powerapps

(0) ShareShare
ReportReport
Posted on by 531

Hi Guyz, I want to display data from CDS in my powerapp as a excel view, like below. I tried with datatable, but I have multiple datasources from CDS. I understand we can bind datatable with only 1 datasource. Please let me know any suggestions. 

 

Img.png

 

 

 

 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,923 on at

    You need to show sample data or columns of the various datasources

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Iantaylor2050 Profile Picture
    531 on at

    Hi @eka24 

     

    There are 2 entities in CDS. I need to show records in the datatable/excel format in powerapp as in the image, by combining both the entities based on business logic.

     

    I understand I can bind datatable to only 1 datasource. Not sure how to bind multiple datasource to a datatable. Any inputs would be helpful. It is the column along with data which i need to show. Thanks.

    Img.png

     

     

     

     

  • eka24 Profile Picture
    20,923 on at

    From what you have shown which one is the first table and which is the second table. Are the column names the same?

    If they are the same as it is not clear in your picture, use:

    OnSelect of a Button:

    ClearCollect(CombinedTable,Table1,Table2)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Iantaylor2050 Profile Picture
    531 on at

    Hi @eka24 

     

    Yes, column header is same for both tables. The one highlighted in yellow is data from Table 1 and the one highlighted in white is data from Table 2.  Based on ID field, I will populate the data where Table1.ID= Table2.ID

     

    Img1.PNG

     

     
  • eka24 Profile Picture
    20,923 on at

    If they are the same columns then insert a button and OnSelect of a Button put:

    ClearCollect(CombinedTable,Table1,Table2)

     

    Please change Table1,Table2 to the actual datasource or Table names in your CDS

     

    You can also put the formula OnStart or OnVisible of the screen.

     

    Finally, on the Items of the DataTable or Gallery, put: CombinedTable

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • v-xida-msft Profile Picture
    on at

    Hi @Iantaylor2050 ,

    Do you want to combine multiple Entities into single one table?

    Do you want to display the related records from your Table 2 based on the ID field in your Table1?

     

    Based on the needs that you mentioned, I think nested Galleries could achieve your needs. On your side, you could add a Gallery control (Gallery1) in your app, set the Items property to following:

    Table1

    add several Labels within this Gallery to display corresponding column value from your Table1 through the following formula (set the Text):

    ThisItem.ColumnName

     

    Then add a nested Gallery (Gallery2) within above Gallery (Gallery1), then set the Item property of this nested Gallery to following:

    Filter(Table2, ID = ThisItem.ID)

    then within this nested Gallery, add several Labels to display corresponding column values from the Table2.

     

    More details about add a nested Gallery within a Gallery, please check the following article:

    https://www.youtube.com/watch?v=EnBpWBb51hs

     

    Best regards,

  • Iantaylor2050 Profile Picture
    531 on at

    Hi @v-xida-msft @eka24 ,

     

    I have around 30+ columns in my entity. Do you think, it would be feasible enough to display 30+ columns using a gallery instead of datatable ?

     

    Also I want to show in a table like structure in my powerapp. I understand using a gallery, we can't get a table structure with borders and rows similar to datatable.

     

     

     

     

  • v-xida-msft Profile Picture
    on at

    Hi @Iantaylor2050 ,

    Yeah, The Data Table control could display data as Tabular format as that in your CDS Entity, but we could not add a Data Table inside another Data Table, which may not achieve your needs.

     

    You could consider make your canvas app as Tablet Layout, then you could add Gallery controls in the screen to achieve your needs. The Gallery would be flexible than Data Table control in customization.

     

    In addition, you could also edit the data within the Gallery directly once you have configured your Gallery as Editable GRID. Please check and see if the following video would help in your scenario:

    https://www.youtube.com/watch?v=41Mpgn7svLs&t=1s

     

    Best regards,

  • Iantaylor2050 Profile Picture
    531 on at

    Hi @v-xida-msft @eka24 

     

    I have gone through the link. I understand that the header of the gallery is created separate.

     

    Since my requirement has 30+ column in header, it would be more difficult to create a separate header. If its 5 or 6 column, its fine. Since its 30+ column, it would create a scroll bar on header which would affect the look and feel. 

     

    Any alternative approach like using html code ?

     

     

  • v-xida-msft Profile Picture
    on at

    Hi @Iantaylor2050 ,

    Do you want to achieve your needs using HTML code?

     

    Currently, within PowerApps, if you want to write HTML code, I think the HTML Text control could achieve your needs. I have made a test on my side, please take a try with the following workaround:

    9.JPG

    On your side, you should set the Html Text property of the Html Text control to following:

    "<table width='100%' border='1' cellpadding='5' style='border:3px solid black; border-collapse:collapse'>" &
    Concat(
     ForAll(
     RenameColumns(Table1, "ID", "ID1"),
     "<tr>
     <td>" & Column1_Table1 & "</td>
     <td>" & Column2_Table1 & "</td>
     <td>" & Column3_Table1 & "</td>
     </tr> " & 
     Concat(
     Filter(Table2, ID = ID1),
     "<tr>
     <td>" & Column1_Table2 & "</td>
     <td> " & Column2_Table2 & "</td>
     <td> " & Column3_Table2 & "</td>
     </tr> 
     "
     )
     ),
     Value
    )
    &
    "</table>"

    Noe: Please replace the Column1_Table1, Column2_Table2, ... with actual column names from your Table1. Replace the Column1_Table2, Column2_Table2, .... with actual column names from your Table2.

     

    Please check and see if the following thread or blog would help in your scenario:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/PowerApps-How-to-print-insert-content-of-nested-table-in-HTML/td-p/109798

    https://powerapps.microsoft.com/en-us/blog/html-email-reporting-with-tabular-data/

     

    Best regards,

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