cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aec2018
Microsoft
Microsoft

Change how many columns to display and their names based on API response? (GraphQL)

My team wants to create a no-code/low-code site to display some table data that can also be edited/created so I'll be using a gallery table. The end goal would be where the user can select what columns they want to see (we have 30+) and then the table is created from the JSON a GraphQL endpoint returns. Is that possible in PowerApps? Everything I'm seeing is tables created with hard coded columns and column names in a gallery table based on a data source (usually SQL or SharePoint List). Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
BCLS776
Super User
Super User

Depending how far you want to take this, you should be able to do much of this with Power Apps. You can exploit the Visible and FieldDisplayName properties of a DataTable to dynamically control the name and whether a particular column displays or not.

 

It sounds like you understand the primary limitation though - the schema has to be known during app construction to properly set it up. You'll build the table with ALL possible columns, and then display only those you want. The custom connector to the Graph API has to be defined in advance, not dynamically. If those limitations still fit your use case, then have at it.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
BCLS776
Super User
Super User

Depending how far you want to take this, you should be able to do much of this with Power Apps. You can exploit the Visible and FieldDisplayName properties of a DataTable to dynamically control the name and whether a particular column displays or not.

 

It sounds like you understand the primary limitation though - the schema has to be known during app construction to properly set it up. You'll build the table with ALL possible columns, and then display only those you want. The custom connector to the Graph API has to be defined in advance, not dynamically. If those limitations still fit your use case, then have at it.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

If I'm understanding you correctly, I'd have to create the full table with all 30+ columns and column names, then send the request for only certain columns of data, and when receiving the response, perhaps set visibility of a column based on all empty values in that column? 


@aec2018 wrote:

If I'm understanding you correctly, I'd have to create the full table with all 30+ columns and column names, then send the request for only certain columns of data, and when receiving the response, perhaps set visibility of a column based on all empty values in that column? 


We are close to understanding the same thing. In your case, you need to make sure your app "knows" about and can handle all columns it will receive, even if they aren't displayed. Power Apps relies on knowing the schema before runtime, so if that were to change later the app would probably error out. And yes, the visibility of labels and other controls can be made dependent on the data that comes back to the app.

 

Make sense?

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Yeah, it makes sense. It's not a truly "dynamic" table being created the way, let's say, React would. It's a hard coded table with a pre-defined schema and just some show/no show logic for each column. It's kind of what I figured would be done with PowerApps since it's meant to be low maintenance. Thanks for your input, I think it really puts me on the right track. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,140)