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.

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,164)